csv_localizations 0.0.1 copy "csv_localizations: ^0.0.1" to clipboard
csv_localizations: ^0.0.1 copied to clipboard

outdated

Localize your app using a single CSV file for all languages.

csv_localizations #

Localize your app using a single CSV file for all translations.

A minimal implementation based on LocalizationsDelegate.

Install #

Add package to your pubspec.yaml:

dependencies:
  csv_localizations:

Usage #

Add a CSV translation file as an asset and describe it in your pubspec.yaml:

Tip: Create a Spreadsheet via Google docs, then export as CSV

flutter:
  assets:
    - assets/lang.csv

The translation file's top row describes language codes, like: en, nb.

The rows below represent words in various languages.

CSV translation example:

str, en, nb
Hi, Hi, Hei
Cheese, Cheese, Ost

Add CsvLocalizationsDelegate to MaterialApp.localizationsDelegates and set MaterialApp.supportedLocales:

localizationsDelegates:[
  ... // global delegates
  CsvLocalizationsDelegate(
    CsvLocalizations(
      assetPath: 'assets/lang.csv',
      supportedLanguageCodes: ['en', 'nb'],
    ),
  ),
]
supportedLocales: [Locale('en'), Locale('nb')],

Now translate strings using:

  CsvLocalizations.of(context).tr('Hi')

Note for iOS

Add supported locales to ios/Runner/Info.plist as described here.

Example:

<key>CFBundleLocalizations</key>
<array>
	<string>en</string>
	<string>nb</string>
</array>

Example #

See example

6
likes
0
pub points
77%
popularity

Publisher

verified publisherapptakk.com

Localize your app using a single CSV file for all languages.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

csv, flutter

More

Packages that depend on csv_localizations