{"id":20819960,"url":"https://github.com/elo7/i18n-amd","last_synced_at":"2026-05-22T04:37:44.475Z","repository":{"id":35160944,"uuid":"39406620","full_name":"elo7/i18n-amd","owner":"elo7","description":"I18n.js is a library that helps working with internationalization on javascript.","archived":false,"fork":false,"pushed_at":"2021-07-26T08:57:37.000Z","size":26,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":98,"default_branch":"master","last_synced_at":"2025-02-18T00:07:12.739Z","etag":null,"topics":["amd","front-end","i18n","javascript","lib","martell","nymeros"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ujjwalkarn/Machine-Learning-Tutorials","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elo7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-20T20:23:11.000Z","updated_at":"2020-07-02T21:31:57.000Z","dependencies_parsed_at":"2022-09-03T06:21:52.233Z","dependency_job_id":null,"html_url":"https://github.com/elo7/i18n-amd","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Fi18n-amd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Fi18n-amd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Fi18n-amd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elo7%2Fi18n-amd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elo7","download_url":"https://codeload.github.com/elo7/i18n-amd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243165938,"owners_count":20246817,"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":["amd","front-end","i18n","javascript","lib","martell","nymeros"],"created_at":"2024-11-17T22:07:55.886Z","updated_at":"2025-12-27T07:35:52.391Z","avatar_url":"https://github.com/elo7.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# I18n-amd\n_I18n-amd internationalization library_\n\nI18n.js is a library that helps working with internationalization on javascript. This library uses [amd](http://en.wikipedia.org/wiki/Asynchronous_module_definition) structure.\n[![Build Status](https://travis-ci.org/elo7/i18n-amd.svg?branch=master)](https://travis-ci.org/elo7/i18n-amd)\n\n## Install\n\nInstall with [npm](https://www.npmjs.com): `npm install elo7-i18n-amd`\n\n## Dependency\n\nI18n-amd depends on an [amd](http://en.wikipedia.org/wiki/Asynchronous_module_definition) implementation. We suggest [async-define](https://github.com/elo7/async-define) implementation for dependency lookup.\nI18n-amd also depends on [ajax-amd](https://github.com/elo7/ajax-amd) and a stable version is already defined in `package.json`. You only need to install with [npm](https://www.npmjs.com) and load i18n-amd and ajax-amd files on your page.\nI18n-amd expects an endpoint with the url \"/i18n/{messageKey}\" to return a JSON response with the following structure:\n```js\n{\n\tversion: 1,\n\tmessage: \"Confirm\",\n\tkey: \"words.Confirm\"\n}\n```\nThis one should be implemented on your web application.\n\nFor pluralized keys it's expect the following message structure:\n```\n{\n\tversion: 1,\n\tmessage: \"No product\",\n\tkey: \"products.zero\"\n},\n{\n\tversion: 1,\n\tmessage: \"One product\",\n\tkey: \"products.one\"\n},\n{\n\tversion: 1,\n\tmessage: \"{0} products\",\n\tkey: \"products.other\"\n}\n```\n\nFor formatted messages, it's expect the following message structure:\n```js\n{\n\tversion: 1,\n\tmessage: \"Hello {0}! Have a {1} day!\",\n\tkey: \"args.example\"\n}\n```\n\n## Methods\n\n#### get\n`.get(key)`\n\n###### Description:\nReturns an internationalized message for the given key. This method caches the key, value and version on `localStorage` to avoid unecessary requests. The current version of your application is stored on `sessionStorage`, if the message version doesn't match current version, a new request is done to update the cached value with the new message.\n\n###### Sample:\n``` js\ndefine(['i18n'], function(i18n) {\n\t// words.Confirm=Confirm\n\ti18n.get('words.Confirm'); // Returns \"Confirm\"\n});\n```\n#### count\n`.count(key, size)`\n\n###### Description:\nReturns the pluralized internationalized message for the given key. It's also replace `{0}` with the size parameter. This method uses `get` method and caches the message on the same way.\n\n###### Sample:\n``` js\ndefine(['i18n'], function(i18n) {\n\ti18n.count('products', 0); // Returns \"No product\"\n\ti18n.count('products', 1); // Returns \"One product\"\n\ti18n.count('products', 2); // Returns \"2 products\"\n});\n```\n#### args\n`.args(key, args...)`\n\n###### Description:\nReturns internationalized message for the given key formatted with arguments. The message should contains `{n}` to be replaced with the argument[n]. This method also uses `get` method on background and caches the message on the same way.\n\n###### Sample:\n``` js\ndefine(['i18n'], function(i18n) {\n\ti18n.args('args.example', 'Bielo', 'nice'); // Returns \"Hello Bielo! Have a nice day!\"\n});\n```\n\n#### domain\n`.domain(\"example.com\")`\n\n###### Description:\nSets an optional domain which i18n lib will make requests for the internationalization. This variable needs to be set before any `get()` usage if the domain isn't the same as the current page.\n\n###### Sample:\n``` js\ndefine(['i18n'], function(i18n) {\n\ti18n.domain(\"some-domain.com\");\n});\n```\n\n## License\n\nEvent-amd is released under the [BSD](https://github.com/elo7/i18n-amd/blob/master/LICENSE). Have at it.\n\n* * *\n\nCopyright :copyright: 2019 Elo7# i18n-amd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felo7%2Fi18n-amd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felo7%2Fi18n-amd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felo7%2Fi18n-amd/lists"}