{"id":21260718,"url":"https://github.com/erf/json_localizations","last_synced_at":"2025-07-18T17:32:04.808Z","repository":{"id":56833364,"uuid":"387046164","full_name":"erf/json_localizations","owner":"erf","description":"A minimal YAML localization package built on LocalizationsDelegate","archived":false,"fork":false,"pushed_at":"2025-07-07T22:48:00.000Z","size":182,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T04:00:31.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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":"2021-07-17T22:18:22.000Z","updated_at":"2025-07-07T22:48:05.000Z","dependencies_parsed_at":"2025-01-21T21:47:52.824Z","dependency_job_id":"b8ba0777-529a-49ae-b89d-caf5606addde","html_url":"https://github.com/erf/json_localizations","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/erf/json_localizations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Fjson_localizations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Fjson_localizations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Fjson_localizations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Fjson_localizations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erf","download_url":"https://codeload.github.com/erf/json_localizations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erf%2Fjson_localizations/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265801813,"owners_count":23830470,"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":[],"created_at":"2024-11-21T04:20:19.266Z","updated_at":"2025-07-18T17:32:04.753Z","avatar_url":"https://github.com/erf.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json_localizations\n\nA minimal [JSON](https://en.wikipedia.org/wiki/JSON) localization package for Flutter.\n\nUse a JSON file/object per language to represent key/value pairs for localizing your app.\n\n## Install\n\nAdd `json_localizations` and `flutter_localizations` as dependencies to your `pubspec.yaml`.\n\n```yaml\ndependencies:\n  flutter_localizations:\n    sdk: flutter\n  json_localizations:\n```\n\n### Add a JSON file per language\n\nAdd a JSON file per language you support in an asset `path` and describe it in your `pubspec.yaml`\n\n```yaml\nflutter:\n  assets:\n    - assets/json_translations/\n```\n\nThe JSON file name must match exactly the combination of language and country code described in `supportedLocales`.\n\nThat is `Locale('en', 'US')` must have a corresponding `assetPath/en-US.json` file.\n\n\n### Add `JsonLocalizationsDelegate` to `MaterialApp`\n\nAdd `JsonLocalizationsDelegate` to `MaterialApp` and set `supportedLocales` using language/country codes.\n\n```\nMaterialApp(\n  localizationsDelegates: [\n    // delegate from flutter_localization\n    GlobalMaterialLocalizations.delegate,\n    GlobalWidgetsLocalizations.delegate,\n    GlobalCupertinoLocalizations.delegate,\n    // delegate from json_localizations\n    JsonLocalizationsDelegate('assets/json_translations'),\n  ],\n  supportedLocales: [\n    Locale('en'),\n    Locale('nb'),\n  ],\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-GB\u003c/string\u003e\n\t\u003cstring\u003een\u003c/string\u003e\n\t\u003cstring\u003enb\u003c/string\u003e\n\u003c/array\u003e\n```\n\n\n## Format\n\nExample JSON file:\n\n```json\n{\n\t\"hello\": \"hello\",\n\t\"bye\": \"bye\",\n\t\"items\": [ \"one\", \"two\", \"three\" ],\n\t\"count\": 1\n}\n```\n\n\u003e Tip: You can store any json type given a key, like a string, an array of strings, or a number\n\n### API\n\nGet a value for the current language using:\n\n```dart\nJsonLocalizations.of(context)?.value('hello')\n```\n\nWe keep the API simple, but you could easily add an extension method to `String`:\n\n```dart\nextension LocalizedString on String {\n  String tr(BuildContext context) =\u003e JsonLocalizations.of(context)!.value(this);\n}\n```\n\nSo you could write:\n\n```dart\n'hello'.tr(context)\n```\n\n## Example\n\nSee [example](example).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferf%2Fjson_localizations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferf%2Fjson_localizations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferf%2Fjson_localizations/lists"}