{"id":28932959,"url":"https://github.com/davyjoneslocker/ember-cli-i18n","last_synced_at":"2025-12-16T15:03:20.220Z","repository":{"id":57223298,"uuid":"27022174","full_name":"DavyJonesLocker/ember-cli-i18n","owner":"DavyJonesLocker","description":"Simple Internationalization support for ember-cli apps","archived":false,"fork":false,"pushed_at":"2015-07-08T12:52:43.000Z","size":731,"stargazers_count":111,"open_issues_count":34,"forks_count":28,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-09-23T21:27:10.755Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/DavyJonesLocker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-23T04:37:56.000Z","updated_at":"2024-11-13T11:07:40.000Z","dependencies_parsed_at":"2022-08-24T15:41:41.356Z","dependency_job_id":null,"html_url":"https://github.com/DavyJonesLocker/ember-cli-i18n","commit_stats":null,"previous_names":["dockyard/ember-cli-i18n"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/DavyJonesLocker/ember-cli-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fember-cli-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fember-cli-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fember-cli-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fember-cli-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavyJonesLocker","download_url":"https://codeload.github.com/DavyJonesLocker/ember-cli-i18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavyJonesLocker%2Fember-cli-i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27766811,"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","status":"online","status_checked_at":"2025-12-16T02:00:10.477Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-06-22T17:10:19.144Z","updated_at":"2025-12-16T15:03:20.214Z","avatar_url":"https://github.com/DavyJonesLocker.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ember CLI i18n\n\n# Deprecated!\n\nThis library has been deprecated in favor of [ember-i18n \u003e= 4.0.0](https://github.com/jamesarosen/ember-i18n)\n\n[![Build](https://travis-ci.org/dockyard/ember-cli-i18n.svg?branch=master)](https://travis-ci.org/dockyard/ember-cli-i18n)\n\n## About ##\n\nSimple Internationalization support for ember-cli apps.\n\n**Note: This release requires Ember 1.10.**\n\n## Install ##\n\n```bash\nnpm install ember-cli-i18n --save-dev\n```\n\n## Usage ##\n\n### Translate\n\n#### Configuration\n\nIn your app's `config/environment.js` you'll need to set\n`ENV.APP.defaultLocale` to a country code:\n\n```javascript\nvar ENV = {\n  APP: {\n    defaultLocale: 'en'\n  }\n};\n```\n\n`defaultLocale` is only the fallback. If you wanted to change the locale\nof the application you should modify your application's `locale`:\n\n```js\nvar set = Ember.set;\nvar application = container.lookup('application:main');\nset(application, 'locale', 'fr');\n```\n\nYou can can trigger this after authentication, or if the user modifies a\nlanguage setting in the app. Of course when this state is removed you\nshould clear `locale` so that internationalization fallback to\n`defaultLocale`.\n\n#### Locale Files\n\nGenerate a new locale file:\n\n```\nember g locale en\n```\n\nThe file will be added to `app/locales`\n\n```\napp\n└── locales\n    └── en.js\n```\n\nThen export a single POJO:\n\n```javascript\nexport default {\n  home: {\n    title: 'Welcome'\n  }\n};\n```\n\n##### Interpolation\n\nYou can add keys for interpolation\n\n```javascript\nexport default {\n  age: 'You are %@1 years old.',\n  name: '%@, %@'\n};\n```\n\nThe rules for interpolation follow the same from\n[`Ember.String.fmt`](http://emberjs.com/api/classes/Ember.String.html#method_fmt)\n\n#### Pluralization\n\nPluralization keys follow the format from\n[CLDR](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html).\nFor example, for `en` it expects only the keys `one` and `other`:\n\n```javascript\nexport default {\n  friend: {\n    one: 'only one friend, %@2',\n    other: '%@ friends, %@'\n  }\n};\n```\n\nThe first value passed will be considered the `count` for determining\nhow to pluralize. \n\n```javascript\nt('friend', 0, 'Brian');\n// 0 friends, Brian\n\nt('friend', 1, 'Brian');\n// only one friend, Brian\n\nt('friend', 10, 'Brian');\n// 10 friends, Brian\n```\n\nHyphenated languages will be split and the first half will be used to\ndetermine the pluralization rules. So both `en-us` and `en-gb` will\nfollow the `en` rules.\n\n[View the currently supported set of pluralization rules](/addon/rules/).\n\n#### Helper\n\nYou can access the translations in your app with the `t` helper:\n\n```handlebars\n{{t 'home.title'}}\n```\n\nComputed properties for the path are also supported:\n\n```handlebars\n{{t age}}\n```\n\nIf the value has interpolation keys you can pass those values:\n\n```handlebars\n{{t colors colorOne colorTwo}}\n```\n\n#### Utility\n\nThe `t` function can be used outside of templates as a utility function:\n\n```javascript\nimport Ember from 'ember';\n\nexport default Ember.Object.extend({\n  foo: function() {\n    var t = container.lookup('utils:t');\n    return t('foo.bar');\n  }\n});\n```\n\n`t` is automatically injected into **Controllers**, **Components**,\n**Routes**, and **Models**:\n\n```javascript\nexport default DS.Model.extend({\n  name: function() {\n    return this.t('name', 'John', 'Doe');\n  }\n});\n```\nNote that interpolation values can also be passed as an array if you prefer this style. `this.t('name', ['John', 'Doe'])` \n\n### Overriding the Locale Lookup Handler\n\nBy default locales are attempted to be looked as modules in your\nproject. However, you may wish to override how this is done. You can do that by overriding the locale lookup handler. Let's assume you have all of your locales stored in a single POJO.\n\nYou'll first need to create a new file: `my-app/services/i18n.js`\n\n```javascript\nimport service from 'ember-cli-i18n/services/i18n';\n\nservice.getLocalizedPath = function(locale, path) {\n  return Locales[locale][path];    \n}\n\nexport default service;\n```\n\nThe default service object that was imported has three functions that\ncan be overridden and customized:\n\n#### `resolveLocale`\n\n* **Paramaters**: `container`, `scope`\n* **Returns**: locale code\n\n#### `getLocalizedPath`\n* **Paramaters**: `locale`, `path`, `container`, `scope`\n* **Returns**: string or object\n\n#### `applyPluralizationRules`\n* **Paramaters**: `result`, `locale`, `path`, `container`, `values`,\n  `scope`\n* **Returns**: if `result` is a string, will skip rules and return\n  `result`. If `result` is an `Object`, will assume pluralization needs\nto apply and formats `result` with proper pluralization rules based upon\n`values[0]`\n\n#### `fmt`\n* **Paramaters**: `result`, `values`\n* **Returns**: formatted string\n\nThis function delegates to `Ember.String.fmt` by default. You can override\n\n## Authors ##\n\n* [Brian Cardarella](http://twitter.com/bcardarella)\n\n[We are very thankful for the many contributors](https://github.com/dockyard/ember-cli-i18n/graphs/contributors)\n\n## Versioning ##\n\nThis library follows [Semantic Versioning](http://semver.org)\n\n## Want to help? ##\n\nPlease do! We are always looking to improve this gem. Please see our\n[Contribution Guidelines](https://github.com/dockyard/ember-cli-i18n/blob/master/CONTRIBUTING.md)\non how to properly submit issues and pull requests.\n\n## Legal ##\n\n[DockYard](http://dockyard.com/ember-consulting), Inc \u0026copy; 2014\n\n[@dockyard](http://twitter.com/dockyard)\n\n[Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavyjoneslocker%2Fember-cli-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavyjoneslocker%2Fember-cli-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavyjoneslocker%2Fember-cli-i18n/lists"}