Skip to content

Commit d03129e

Browse files
authored
Merge pull request #1141 from motasimfuad/flutter/localization
Add localization section to flutter cheatsheet
2 parents 35f1578 + 95bf9a7 commit d03129e

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

data/flutter.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,55 @@
302302
}
303303
]
304304
},
305+
{
306+
"title": "ফ্লাটার লোকালাইজেশন (Flutter Internationalization)",
307+
"items": [
308+
{
309+
"definition": "লোকালাইজেশন কি?",
310+
"code": "লোকালাইজেশন হলো একটি অ্যাপে ভিন্ন ভিন্ন ভাষার অনুবাদ রাখা। যার মাধ্যমে ইউজার তাঁর পছন্দ মতো ভাষায় অ্যাপটি ব্যবহার করতে পারে।"
311+
},
312+
{
313+
"definition": "প্রথমেই প্রয়োজনীয় ডিপেন্ডেন্সি যোগ করতে হবে",
314+
"code": "dependencies:\n flutter_localizations: ^0.2.2\n intl: ^0.19.0"
315+
},
316+
{
317+
"definition": "pubspec.yaml এ generate ফ্ল্যাগ যোগ করুন",
318+
"code": "flutter:\n generate: true"
319+
},
320+
{
321+
"definition": "l10n.yaml ফাইল তৈরি করুন",
322+
"code": "arb-dir: lib/l10n\ntemplate-arb-file: app_en.arb\noutput-localization-file: app_localizations.dart"
323+
},
324+
{
325+
"definition": "ARB ফাইল তৈরি করুন (lib/l10n/app_en.arb)",
326+
"code": "{\n \"helloWorld\": \"Hello World!\",\n \"@helloWorld\": {\n \"description\": \"The conventional newborn programmer greeting\"\n }\n}"
327+
},
328+
{
329+
"definition": "MaterialApp এ লোকালাইজেশন ডেলিগেট যোগ করুন",
330+
"code": "import 'package:flutter_localizations/flutter_localizations.dart';\nimport 'package:flutter_gen/gen_l10n/app_localizations.dart';\n\nMaterialApp(\n localizationsDelegates: [\n AppLocalizations.delegate,\n GlobalMaterialLocalizations.delegate,\n GlobalWidgetsLocalizations.delegate,\n GlobalCupertinoLocalizations.delegate,\n ],\n supportedLocales: [\n Locale('en', ''), // English\n Locale('bn', ''), // Bengali\n ],\n)"
331+
},
332+
{
333+
"definition": "Ui তে টেক্সট ব্যবহার করতে -",
334+
"code": "Text(AppLocalizations.of(context)!.helloWorld)"
335+
},
336+
{
337+
"definition": "প্যারামিটার সহ অনুবাদ করতে -",
338+
"code": "// In ARB file:\n{\n \"greetingMessage\": \"Hello {name}\",\n \"@greetingMessage\": {\n \"placeholders\": {\n \"name\": {\n \"type\": \"String\",\n \"example\": \"Bob\"\n }\n }\n }\n}\n\n// In Dart code:\nText(AppLocalizations.of(context)!.greetingMessage('Alice'))"
339+
},
340+
{
341+
"definition": "বর্তমান ভাষা পরিবর্তন করতে -",
342+
"code": "Locale newLocale = Locale('bn', '');\nFlutterI18n.refresh(context, newLocale);"
343+
},
344+
{
345+
"definition": "ডিভাইসের ডিফল্ট লোকেল পেতে -",
346+
"code": "Locale myLocale = Localizations.localeOf(context);"
347+
},
348+
{
349+
"definition": "অনুবাদ জেনারেট করতে টার্মিনালে রান করুন -",
350+
"code": "flutter gen-l10n"
351+
}
352+
]
353+
},
305354
{
306355
"title": "ফ্লাটার WebRTC (Implementing WebRTC in Flutter)",
307356
"items": [

0 commit comments

Comments
 (0)