{"id":21835740,"url":"https://github.com/vtex/angular-locale","last_synced_at":"2025-06-18T18:08:11.425Z","repository":{"id":36192102,"uuid":"40496305","full_name":"vtex/angular-locale","owner":"vtex","description":null,"archived":false,"fork":false,"pushed_at":"2015-09-29T17:24:35.000Z","size":144,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":184,"default_branch":"master","last_synced_at":"2025-05-15T23:09:54.518Z","etag":null,"topics":["srv-oms-ui","xp-post-purchase"],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"flowstudio/datalize","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vtex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-10T17:35:33.000Z","updated_at":"2019-07-03T20:48:35.000Z","dependencies_parsed_at":"2022-08-02T15:30:24.770Z","dependency_job_id":null,"html_url":"https://github.com/vtex/angular-locale","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vtex/angular-locale","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fangular-locale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fangular-locale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fangular-locale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fangular-locale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vtex","download_url":"https://codeload.github.com/vtex/angular-locale/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fangular-locale/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260226815,"owners_count":22977816,"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":["srv-oms-ui","xp-post-purchase"],"created_at":"2024-11-27T20:24:18.451Z","updated_at":"2025-06-18T18:08:06.412Z","avatar_url":"https://github.com/vtex.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular Locale\nCurrency and Locale manager for AngularJS\n\n## Usage\n\n#### Reference script\n```html\n\u003cscript src=\"angular-locale.min.js\"\u003e\u003c/script\u003e\n```\n\n#### Inject `vtex.ngLocale`\n```coffeescript\nangular.module 'yourApp', ['vtex.ngLocale']\n```\n\n### Events\n#### localeSelected.vtex\n- `LocaleService` automatically **listens** to this and expects `lang` arguments.\n- `lang` follows 'xx-XX' format, e.g.: 'en-US'.\n- Therefore both `tmhDynamicLocale` and `$translate` (in this order) are called and updated with new i18n data.\n\n#### localeUpdated.vtex\n- `LocaleService` **triggers** this once it has set `$translate` to use new language and i18n is updated.\nObs: `setCurrency` is called everytime language/locale gets updated, since it will reset `$locale.NUMBER_FORMATS` each time.\n\n#### currencyUpdated.vtex\n- `LocaleService` **triggers** this once it has set `$locale` according to current currency configuration.\n\n### API `LocaleService`\n#### setLanguage language\n- string `eventName`, Object `data` with any information you want to be registered within the event\n\n#### setCurrency currencyConfiguration\n- currencyConfiguration `Object` for United States Dollar:\n\n```coffeescript\ncurrencySymbol: '$ '\ndecimalSeparator: ','\ngroupSeparator: '.'\nngPatterns:\n  gSize: 3\n  lgSize: 3\n  macFrac: 0\n  maxFrac: 2\n  minFrac: 2\n  minInt: 1\n  negPre: \"- \\u00a4\"\n  negSuf: \"\"\n  posPre: \"\\u00a4\"\n  posSuf: \"\"\n```\n\nThis gets mapped into Angular's `$locale`:\n\n```coffeescript\n$locale.NUMBER_FORMATS.CURRENCY_SYM = currencyConfiguration.currencySymbol\n$locale.NUMBER_FORMATS.DECIMAL_SEP = currencyConfiguration.decimalSeparator\n$locale.NUMBER_FORMATS.GROUP_SEP = currencyConfiguration.groupSeparator\n$locale.NUMBER_FORMATS.PATTERNS[1] = currencyConfiguration.ngPatterns\n```\n\n*Obs:* ngPatterns/NUMBER_FORMATS.PATTERNS[1] has a default value, no worries :)\n\n## Development\nInside `src` you can find this module source code, written in **CoffeeScript**. To build the `.js` and uglify it, install npm dev-dependencies and run grunt:\n\n    (sudo) npm i\n    grunt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex%2Fangular-locale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvtex%2Fangular-locale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex%2Fangular-locale/lists"}