{"id":22050161,"url":"https://github.com/icapps/flutter-icapps-translations","last_synced_at":"2025-05-08T23:20:56.073Z","repository":{"id":44999943,"uuid":"239534263","full_name":"icapps/flutter-icapps-translations","owner":"icapps","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-05T12:12:38.000Z","size":600,"stargazers_count":3,"open_issues_count":5,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T19:21:13.393Z","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/icapps.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}},"created_at":"2020-02-10T14:40:32.000Z","updated_at":"2023-11-01T07:58:32.000Z","dependencies_parsed_at":"2023-02-10T14:45:15.982Z","dependency_job_id":"4fdb3a95-f7aa-498d-be2e-a8b66638c14b","html_url":"https://github.com/icapps/flutter-icapps-translations","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-icapps-translations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-icapps-translations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-icapps-translations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-icapps-translations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icapps","download_url":"https://codeload.github.com/icapps/flutter-icapps-translations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253161336,"owners_count":21863725,"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-30T14:18:03.805Z","updated_at":"2025-05-08T23:20:56.026Z","avatar_url":"https://github.com/icapps.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter icapps translations\n\nA dart package to automaticly download translations from the icapps translation tool. The rest of the implementation is done by locale_gen https://pub.dev/packages/locale_gen\n\n[![pub package](https://img.shields.io/pub/v/icapps_translations.svg)](https://pub.dartlang.org/packages/icapps_translations)\n[![Build Status](https://app.travis-ci.com/icapps/flutter-icapps-translations.svg?branch=master)](https://app.travis-ci.com/icapps/flutter-icapps-translations)\n[![Coverage Status](https://coveralls.io/repos/github/icapps/flutter-icapps-translations/badge.svg?branch=master)](https://coveralls.io/github/icapps/flutter-icapps-translations?branch=master)\n[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)\n\n## Example\n\n\u003cimg src=\"https://github.com/icapps/flutter-icapps-translations/blob/master/assets/example.gif?raw=true\" alt=\"Example\" width=\"300\"/\u003e\n\n## Setup\n\n### Add dependency to pubspec\n\n[![pub package](https://img.shields.io/pub/v/icapps_translations.svg)](https://pub.dartlang.org/packages/icapps_translations)\n```yaml\ndependencies:\n  sprintf: ^6.0.2\n\ndev-dependencies:\n  icapps_translations: \u003clatest-version\u003e\n```\n\n### Add config to pubspec\n\nAdd your locale folder to the assets to make use all your translations are loaded.\n```yaml\nflutter:\n  assets:\n    - assets/locale/\n```\n\nAdd the icapps_translations config to fetch the latest translations\n```yaml\nicapps_translations:\n  api_key: 'enter-your-api-key' #For the new translations tool, this is the bearer token\n  project_id: 'optional project id' #To use the new translations tool, enter the project id here\n  default_language: 'nl'\n  languages: ['en', 'nl']\n  locale_assets_path: 'assets/locale/' #This is the location where your json files should be saved.\n  assets_path: 'assets/locale/' #This is the location where your json files are located in your flutter app.\n  nullsafety: true #Generate nullsafety compatible code. Defaults to false\n```\n\nalternatively set an env variable for your api_key and/or project_id\n\n```shell\nAPI_KEY_ICAPPS_TRANSLATIONS\nPROJECT_ID_ICAPPS_TRANSLATIONS\n```\n\n### Run package with Flutter\n\n```shell\nflutter packages pub run icapps_translations\n```\n\n### Run package with Dart\n\n```shell\npub run icapps_translations\n```\n\n### Migration steps \u003c9.0.0 to \u003e=9.0.0\nWith version 9.0.0 of local gen you no longer have static access to the translations, instead you can now manually manage the different localization instances. You can for example store a localization instance as a static. This way you can use it largely the same way as before. Example from the example project:\n\n```dart\nclass LocaleViewModel with ChangeNotifier {\n  static final Localization localizationInstance = Localization();\n  ...\n\n  Future\u003cvoid\u003e init(){\n    await Localization.load(locale: locale);\n    notifyListeners();\n  }\n```\n\nYou can then access this localizationInstance anywhere in the project like:\n```dart\nLocaleViewModel.localizationInstance.translation1;\nLocaleViewModel.localizationInstance.translation2;\nLocaleViewModel.localizationInstance.translation3;\n```\n\n### Migration steps \u003c7.0.0 to \u003e=7.0.0\nWith the newest version of locale_gen the context no longer needs to be provided when accessing the translations. This means there are a couple of breaking changes.\n\nThe first one is that you can now directly get the translation from the Localization object without having to pass the context, so instead of:\n\n```dart\nLocalization.of(context).translation;\n```\n\nyou can now do\n\n```dart\nLocalization.translation;\n```\n\nThe second breaking change is how you initialize/change the locale. Before you could do this by changing the localizationDelegate that is passed to the materialApp, but now you just call the load function of the Localization object. So instead of:\n\n```dart\n      localeDelegate = LocalizationDelegate(\n        newLocale: locale,\n        localizationOverrides: customLocalizationOverrides,\n      );\n```\nyou now do:\n\n```dart\nawait Localization.load(\n      locale: locale,\n      localizationOverrides: customLocalizationOverrides,\n    );\n```\n\n### Arguments\n\nArguments are supported as of 0.1.3\n\nYou can pass a String or a num to as an argument.\n\nFormatting for String: %1$s\nFormatting for num: %1$d\n\nThe number in between % and $ indicate the index of the argument. It is possible to place an argument in 1 language first but in another second:\n\nex (Grammatically incorrect but it makes my point):\n\n```\nnl '%1$s, ik woon in %2$s. Wist je dat niet?' =\u003e KOEN, ik woon in ANTWERPEN. Wist je dat niet?\n\nfr 'I live in %2$s. You didn't knew that %1$s?\" =\u003e I live in ANTWERP. You didn't knew that KOEN?\n```\n\n### Plurals\n\nSince 8.0.0 plurals are supported. To specify a plural, you can use the following syntax in the json file:\n\n```json\n{\n  \"example_plural\": {\n    \"zero\": \"You have no items\",\n    \"one\": \"You have %1$d item\",\n    \"two\": \"You have 2 items, party!\",\n    \"few\": \"You have a few items, nice!\",\n    \"many\": \"You have many items, fantastic!\",\n    \"other\": \"You have %1$d items\"\n  }\n}\n```\nThis will generate functions where you pass the number of items as an argument. The function will then return the correct translation based on the number of items.\nThe count argument *WILL NOT* be passed as an argument for string interpolation.\n\nNote that the \"other\" key is always required, the other keys are dependant on the language in question\n\n### Working on mac?\n\nadd this to you .bash_profile\n\n```shell\nfluttertranslations(){\n flutter packages get \u0026\u0026 flutter packages pub run icapps_translations\n}\n```\n\nnow you can use the icapps translations with a single command.\n\n```shell\nfluttertranslations\n```\n\n## Example\nThis repo contains an example how to use this package.\n\nPackages used:\n - flutter_localizations\n - shared_preferences\n - provider\n - sprintf\n - icapps_translations","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Fflutter-icapps-translations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficapps%2Fflutter-icapps-translations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Fflutter-icapps-translations/lists"}