floca 0.1.0-alpha copy "floca: ^0.1.0-alpha" to clipboard
floca: ^0.1.0-alpha copied to clipboard

outdated

Flutter localization library

Install #

Update pubspec.yaml:

dependencies:
  floca: any

Get:

$ flutter pub get

Check it runs:

$ flutter pub run floca:floca --help

Use #

1. Create the spreadsheet

property en es ru hi
greeting hi! hola! привет! हाय!
farewell bye adiós пока अलविदा

Save it as .csv file, say, string_constants.csv.

2. Generate a .dart file from it

$ flutter pub run floca:floca string_constants.csv string_constants.dart

3. Provide arguments to MaterialApp

import 'string_constants.dart'; // file we created with floca

MaterialApp(
  ...
  supportedLocales: supportedLocales, // add this
  localizationsDelegates: localizationsDelegates, // and this
  ...
);

4. Get localized text in your app

import 'string_constants.dart'; // file we created with floca

Widget build(BuildContext context) {
  // now [context] has a new property [.i18n]  
  String s = context.i18n.greeting;
  return Text(s); 
}
2
likes
0
points
6
downloads

Publisher

verified publisherrevercode.com

Weekly Downloads

Flutter localization library

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

csv, flutter, flutter_localizations, intl

More

Packages that depend on floca