localization_table

Last updated:

0 purchases

localization_table Image
localization_table Images
Add to Cart

Description:

localization table

localization_table #
Localize you app using a localization table.
How to use #


Create your table file with the .csv format.


Put your supported languages in the first row, starting from the second cell.


Put your string keys in the first column, starting from the second cell.


Put your default language in the first cell at (0,0).


Example Table:


Add the LocalizationTableDelegate to your locale delegates.

MaterialApp(
localizationsDelegates: [
LocalizationTableDelegate('assets/table.csv'),
GlobalWidgetsLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
Locale('fa'),
Locale('en'),
],
home: /* ... */
)
copied to clipboard

Use directly with LocalizationTable.of(context).get(key) where key is the string key of the value you want.

Using the extension method #
For ease of use there is a built in extension method that can be used in flutter projects that use dart 2.7.0 or higher.
Example
Text('login'.getString(context))
copied to clipboard
How to use without buildContext #
void backgroundEntryPoint() async{
final locale = Locale('en');

final table = await LocalizationTableDelegate('assets/table.csv').load(locale);

String appName = table.get('app_name');

showNotification(appName);
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.