{"id":21206197,"url":"https://github.com/rtmigo/floca_flutter","last_synced_at":"2025-03-14T23:11:55.052Z","repository":{"id":61973280,"uuid":"354376796","full_name":"rtmigo/floca_flutter","owner":"rtmigo","description":"Library for Flutter app localization. Generates Dart code with string constants, ready to plug into MaterialApp","archived":false,"fork":false,"pushed_at":"2023-09-23T03:55:11.000Z","size":188,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T15:32:13.727Z","etag":null,"topics":["code-generator","csv","excel","flutter","i18n","internationalization","library","localization","spreadsheet","static"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/floca","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtmigo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-03T19:27:25.000Z","updated_at":"2024-03-01T08:27:17.000Z","dependencies_parsed_at":"2025-01-21T15:41:09.127Z","dependency_job_id":null,"html_url":"https://github.com/rtmigo/floca_flutter","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffloca_flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffloca_flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffloca_flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtmigo%2Ffloca_flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtmigo","download_url":"https://codeload.github.com/rtmigo/floca_flutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658274,"owners_count":20326467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generator","csv","excel","flutter","i18n","internationalization","library","localization","spreadsheet","static"],"created_at":"2024-11-20T20:54:46.450Z","updated_at":"2025-03-14T23:11:55.027Z","avatar_url":"https://github.com/rtmigo.png","language":"Dart","readme":"[![Pub Package](https://img.shields.io/pub/v/floca.svg)](https://pub.dev/packages/floca)\n[![pub points](https://badges.bar/floca/pub%20points)](https://pub.dev/floca/tabular/score)\n\n# [floca](https://github.com/rtmigo/floca)\n\nFloca is a **Fl**utter **loca**lization library.\n\nSay, you have an Excel spreadsheet like this:\n\n| property | en     | es      | ru      | hi  |\n|----------|--------|---------|---------|-----|\n| greeting | hi!    | hola!   | привет! | हाय! |\n| farewell | bye    | adiós   | пока    |अलविदा|\n\nFloca will let you access its content like this:\n\n``` dart\nWidget build(BuildContext context) {\n  // getting the strings in proper language\n  var a = context.i18n.greeting;\n  var b = context.i18n.farewell;\n  ...\n}  \n```\n\n# How Floca works\n\nFloca is a command-line app, that takes your `.csv` spreadsheet and generates \na `.dart` file.\n\nThen you import the generated file in the project and get all the needed \nfunctionality, including the localized strings:\n\n```dart\nimport \"newly_generated.dart\";\n```\n\nThis approach gives you maximum compatibility and performance. \nIn addition, many potential errors are prevented at compile time.\n\n\n\n# Install\n\nUpdate `pubspec.yaml`: \n\n``` yaml\ndependencies:\n  flutter_localizations:\n    sdk: flutter\n    \ndev_dependencies:\n  floca: any\n```\n\nGet:\n\n``` bash\n$ flutter pub get\n```\n\nCheck it runs:\n\n``` bash\n$ flutter pub run floca --help\n```\n\n\n\n# Use\n\n#### 1. Create the spreadsheet\n\n| property | en     | es      | ru      | hi  |\n|----------|--------|---------|---------|-----|\n| greeting | hi!    | hola!   | привет! | हाय! |\n| farewell | bye    | adiós   | пока    |अलविदा|\n\nSave it as `.csv` file, say, `string_constants.csv`.\n\n#### 2. Generate a .dart file from it\n\n```bash\n$ flutter pub run floca string_constants.csv lib/string_constants.dart\n```\n\n#### 3. Provide arguments to MaterialApp\n\n``` dart\nimport 'string_constants.dart'; // file we created with floca\n\nMaterialApp(\n  ...\n  supportedLocales: supportedLocales, // add this\n  localizationsDelegates: localizationsDelegates, // and this\n  ...\n);\n```\n\n#### 4. Get localized text in your app\n\n``` dart\nimport 'string_constants.dart'; // file we created with floca\n\nWidget build(BuildContext context) {\n  // now [context] has a new property [.i18n]  \n  String s = context.i18n.greeting;\n  return Text(s); \n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Ffloca_flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtmigo%2Ffloca_flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtmigo%2Ffloca_flutter/lists"}