{"id":21260716,"url":"https://github.com/erf/toml_localizations","last_synced_at":"2025-03-15T06:45:40.438Z","repository":{"id":56841369,"uuid":"265961816","full_name":"erf/toml_localizations","owner":"erf","description":"TOML localization for Flutter","archived":false,"fork":false,"pushed_at":"2024-02-14T19:19:25.000Z","size":191,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T02:50:30.914Z","etag":null,"topics":["dart","flutter","flutter-localization","flutter-localizations","localization","toml","translation"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/toml_localizations","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/erf.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":"2020-05-21T22:10:16.000Z","updated_at":"2023-11-15T11:10:16.000Z","dependencies_parsed_at":"2024-02-14T20:42:42.522Z","dependency_job_id":null,"html_url":"https://github.com/erf/toml_localizations","commit_stats":{"total_commits":71,"total_committers":1,"mean_commits":71.0,"dds":0.0,"last_synced_commit":"bb51b2446dd5b2dcbc4c92a9f2167a9d8772f119"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Ftoml_localizations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Ftoml_localizations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Ftoml_localizations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Ftoml_localizations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erf","download_url":"https://codeload.github.com/erf/toml_localizations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243695537,"owners_count":20332626,"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":["dart","flutter","flutter-localization","flutter-localizations","localization","toml","translation"],"created_at":"2024-11-21T04:20:18.606Z","updated_at":"2025-03-15T06:45:40.411Z","avatar_url":"https://github.com/erf.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# toml_localizations\n\nA minimal [TOML](https://github.com/toml-lang/toml) localization package for\nFlutter.\n\nTOML is a minimal, easy to read, configuration file format, which allows you to\nrepresent [strings](https://github.com/toml-lang/toml#user-content-string) (and\nother types) as key/value pairs.\n\n## Install\n\nAdd `toml_localizations` and `flutter_localizations` as dependencies to your `pubspec.yaml`.\n\n```yaml\ndependencies:\n  flutter_localizations:\n    sdk: flutter\n  toml_localizations: \u003clast-version\u003e\n```\n\n### Add assets\n\nAdd a TOML file per language to a asset path and define it in your `pubspec.yaml`.\n\n```yaml\nflutter:\n  assets:\n    - assets/toml_translations\n```\n\nThe TOML file name must match exactly the combination of language and country\ncode described in `supportedLocales`.\n\nThat is `Locale('en', 'US')` must have a corresponding `assetPath/en-US.toml` file.\n\n### Add localization delegate and supported locales\n\nAdd `TomlLocalizationsDelegate` to `MaterialApp` and set `supportedLocales` to supported language/country codes.\n\n```Dart\nMaterialApp(\n  localizationsDelegates: [\n    // delegate from flutter_localization\n    GlobalMaterialLocalizations.delegate,\n    GlobalWidgetsLocalizations.delegate,\n    GlobalCupertinoLocalizations.delegate,\n    // toml localizations delegate\n    TomlLocalizationsDelegate(path: 'assets/toml_translations')\n  ],\n  supportedLocales: [\n    Locale('en', 'GB'),\n    Locale('en', 'US'),\n    Locale('en'),\n    Locale('nb'),\n  ],\n}\n```\n\n### Note on **iOS**\n\nAdd supported languages to `ios/Runner/Info.plist` as described\n[here](https://flutter.dev/docs/development/accessibility-and-localization/internationalization#specifying-supportedlocales).\n\nExample:\n\n```\n\u003ckey\u003eCFBundleLocalizations\u003c/key\u003e\n\u003carray\u003e\n\t\u003cstring\u003een\u003c/string\u003e\n\t\u003cstring\u003een-GB\u003c/string\u003e\n\t\u003cstring\u003een-US\u003c/string\u003e\n\t\u003cstring\u003enb\u003c/string\u003e\n\u003c/array\u003e\n```\n\n## Format\n\nExample TOML file:\n\n```toml\nstr = \"The quick brown fox jumps over the lazy dog.\"\n\nliteral_str = 'C:\\Users\\nodejs\\templates'\n\nmultiline_str = \"\"\"\\\nThe quick brown \\\nfox jumps over \\\nthe lazy dog.\\\n\"\"\"\n\nliteral_multiline_str = '''\nThe first newline is\ntrimmed in raw strings.\n   All other whitespace\n   is preserved.\n'''\n\nlist = [ 'one', 'two', 'three' ]\n```\n\n\u003e Tip: Toml supports several ways of expressing strings. See Toml documentation for more info.\n\n### API\n\nTranslate strings or other types using:\n\n```Dart\nTomlLocalizations.of(context)!.value(this);\n```\n\nWe keep the API simple, but you can easily add an extension method to `String` like this:\n\n```Dart\nextension LocalizedString on String {\n  String tr(BuildContext context) =\u003e TomlLocalizations.of(context)!.value(this);\n}\n```\n\nSe you could translate strings like this:\n\n```Dart\n'Hi'.tr(context)\n```\n\n## Example\n\nSee [example](example)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferf%2Ftoml_localizations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferf%2Ftoml_localizations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferf%2Ftoml_localizations/lists"}