{"id":21769651,"url":"https://github.com/haiilo/ngx-intl","last_synced_at":"2025-04-13T16:22:50.120Z","repository":{"id":50490029,"uuid":"519246391","full_name":"haiilo/ngx-intl","owner":"haiilo","description":"Standalone Angular pipes using the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting.","archived":false,"fork":false,"pushed_at":"2023-09-13T15:51:37.000Z","size":468,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-27T07:21:15.674Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/haiilo.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":"2022-07-29T14:34:11.000Z","updated_at":"2025-02-01T18:59:11.000Z","dependencies_parsed_at":"2022-08-12T21:21:55.669Z","dependency_job_id":null,"html_url":"https://github.com/haiilo/ngx-intl","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haiilo%2Fngx-intl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haiilo%2Fngx-intl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haiilo%2Fngx-intl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haiilo%2Fngx-intl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haiilo","download_url":"https://codeload.github.com/haiilo/ngx-intl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741902,"owners_count":21154405,"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-26T14:09:28.186Z","updated_at":"2025-04-13T16:22:50.088Z","avatar_url":"https://github.com/haiilo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular Intl\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.1.0. The project provides the following set of **standalone** Angular pipes:\n\n* [`intl-date`](#intl-date)\n* [`intl-timeago`](#intl-timeago)\n* [`intl-list`](#intl-list)\n* [`intl-number`](#intl-number)\n* [`intl-plural`](#intl-plural)\n* [`intl-sort`](#intl-sort)\n\n## What is Intl?\n\nThe Intl object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting. For more information, take a look at the [mdm web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).\n\n## Changelog\n\nThe latest changes are available within this repository in the project's [CHANGELOG](https://github.com/haiilo/ngx-intl/blob/main/projects/ngx-intl/CHANGELOG.md) file.\n\n## `intl-date`\n\nFormat a date according to locale and formatting options.\n\n### Description\n\nJust like the Angular [DatePipe](https://angular.io/api/common/DatePipe), IntlDatePipe is executed only when it detects a pure change to the input value. A pure change is either a change to a primitive input value (such as String, Number, Boolean, or Symbol), or a changed object reference (such as Date, Array, Function, or Object).\n\nNote that mutating a Date object does not cause the pipe to be rendered again. To ensure that the pipe is executed, you must create a new Date object.\n\nThe default locale used for formatting is the one provided by the Angular [`LOCALE_ID`](https://angular.io/api/core/LOCALE_ID) injection token. See the I18n guide for more information. It can also be passed into the pipe as a third parameter.\n\nThe time zone of the formatted value can be specified either by passing it in as a property of the second parameter of the pipe, or by setting the default through the `INTL_DATE_TIMEZONE` injection token. The value that is passed in as the second parameter takes precedence over the one defined using the injection token.\n\n### Pre-defined format options\n\nThe pipe comes with a set of pre-defined format options as shown below.\n\n| Option        | Examples (given in `en-US` locale)              |\n|---------------|-------------------------------------------------|\n| `'short'`     | `6/15/15, 9:03 AM`                              |\n| `'medium'`    | `Jun 15, 2015, 9:03:01 AM`                      |\n| `'long'`      | `June 15, 2015 at 9:03:01 AM GMT+1`             |\n| `'full'`      | `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00` |\n| `'shortDate'` | `6/15/15`                                       |\n| `'mediumDate'`| `Jun 15, 2015`                                  |\n| `'longDate'`  | `June 15, 2015`                                 |\n| `'fullDate'`  | `Monday, June 15, 2015`                         |\n| `'shortTime'` | `9:03 AM`                                       |\n| `'mediumTime'`| `9:03:01 AM`                                    |\n| `'longTime'`  | `9:03:01 AM GMT+1`                              |\n| `'fullTime'`  | `9:03:01 AM GMT+01:00`                          |\n\n### Presets and custom configuration\n\nYou can add custom [configuration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#syntax) and presets using the `INTL_DATE_OPTIONS` injection token. This allows the definition of additional presets as well as setting a default preset, which is used if no preset name is provided to the pipe.\n\n```\n@NgModule({\n  //…,\n  providers: [\n    //…,\n    {\n      provide: INTL_DATE_OPTIONS,\n      useValue: {\n        defaultPreset: 'custom'\n        presets: {\n          custom: {\n            dateStyle: 'short'\n          }\n        }\n      }\n    },\n    {\n      provide: INTL_DATE_TIMEZONE,\n      useValue: 'America/Los_Angeles'\n    }\n  ]\n})\n```\n\n### API\n\n| Parameter    | Type                                  | Description           |\n|--------------|---------------------------------------|-----------------------|\n| `value`      | `Date \\| string \\| number \\| null \\| undefined` | The date to be formatted, given as a JS date, string or number. |\n| `options`    | `string \\| IntlDateLocalOptions`      | The name of a preset or custom formatting options. |\n| `...locales` | `string[]`                            | A list of locale overwrites. |\n\n### Browser compatibility\n\nSee [mdn web docs | Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format#browser_compatibility).\n\n## `intl-timeago`\n\nFormat a relative time according to locale and formatting options.\n\n### Description\n### Pre-defined format options\n### Presets and custom configuration\n### API\n### Browser compatibility\n\nSee [mdn web docs | Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#browser_compatibility) (`Intl.RelativeTimeFormat`) and [mdn web docs | Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format#browser_compatibility) (`Intl.DateTimeFormat`).\n\n\u003c!--\n## `intl-list`\n\nFormat a list according to locale and formatting options.\n\n### Description\n\nThe IntlListPipe transforms a list based on parameters provided in the options. The locales and options parameters customize the behavior of the pipe and let applications specify the language conventions that should be used to format the list.\n\n### Pre-defined format options\n\nThe pipe comes with a set of pre-defined format options as shown below.\n\n| Option  | Examples (given in `en-US` locale) |\n|---------|------------------------------------|\n| `'and'` | `a, b, and c`                      |\n| `'or'`  | `a, b, or c`                       |\n\n### Presets and custom configuration\n\nYou can add custom configuration and presets using the `INTL_LIST_OPTIONS` injection token. This allows the definition of additional presets as well as setting a default preset, which is used if no preset name is provided to the pipe.\n\n```\n@NgModule({\n  //…,\n  providers: [\n    //…,\n    {\n      provide: INTL_LIST_OPTIONS,\n      useValue: {\n        defaultPreset: 'custom'\n        presets: {\n          custom: {\n            style: 'narrow',\n            type: 'unit'\n          }\n        }\n      }\n    }\n  ]\n})\n```\n\n### API\n\n| Parameter    | Type                        | Description           |\n|--------------|-----------------------------|-----------------------|\n| `value`      | `Iterable\u003cstring\u003e \\| null`  |                       |\n| `options`    | `string \\| IntlListOptions` |                       |\n| `...locales` | `string[]`                  |                       |\n\n### Browser compatibility\n--\u003e\n\n## `intl-number`\n\nFormat a number according to locale and formatting options.\n\n### Description\n\n### Pre-defined format options\n### Presets and custom configuration\n### API\n### Browser compatibility\n\nSee [mdn web docs | Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat#browser_compatibility).\n\n## `intl-plural`\n\nEnables plural-sensitive formatting.\n\n### Description\n\nThe IntlPluralPipe provides help for pluralization based on parameters provided in the options. The locales and options parameters customize the behavior of the pipe and let applications specify the language conventions that should be used.\n\n### Pre-defined format options\n\nThe pipe comes with a set of pre-defined sort options as shown below.\n\n| Option         | Examples (given in `en-US` locale) |\n|----------------|------------------------------------|\n| `'cardinal'`   | `3` → `other`                      |\n| `'ordinal'`    | `3` → `few`                        |\n\n### Presets and custom configuration\n\nYou can add custom [configuration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/PluralRules#syntax) and presets using the `INTL_PLURAL_OPTIONS` injection token. This allows the definition of additional presets as well as setting a default preset, which is used if no preset name is provided to the pipe.\n\n```\n@NgModule({\n  //…,\n  providers: [\n    //…,\n    {\n      provide: INTL_PLURAL_OPTIONS,\n      useValue: {\n        defaultPreset: 'custom'\n        presets: {\n          custom: {\n            type: 'ordinal'\n          }\n        }\n      }\n    }\n  ]\n})\n```\n\n### API\n\n| Parameter    | Type                               | Description           |\n|--------------|------------------------------------|-----------------------|\n| `value`      | `number \\| null`                   | The number to be converted. |\n| `options`    | `string \\| IntlPluralLocalOptions` | The name of a preset or custom pluralization options. |\n| `...locales` | `string[]`                         | A list of locale overwrites. |\n\n### Browser compatibility\n\nSee [mdn web docs | Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/PluralRules#browser_compatibility).\n\n## `intl-sort`\n\nEnables language-sensitive string comparison.\n\n### Description\n\nThe IntlSortPipe sorts a list of strings based on parameters provided in the options. The locales and options parameters customize the behavior of the pipe and let applications specify the language conventions that should be used to sort the list.\n\n### Pre-defined format options\n\nYou can add custom [configuration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#syntax) and presets using the `INTL_SORT_OPTIONS` injection token. This allows the definition of additional presets as well as setting a default preset, which is used if no preset name is provided to the pipe.\n\n```\n@NgModule({\n  //…,\n  providers: [\n    //…,\n    {\n      provide: INTL_SORT_OPTIONS,\n      useValue: {\n        defaultPreset: 'custom'\n        presets: {\n          custom: {\n            sensitivity: 'base'\n          }\n        }\n      }\n    }\n  ]\n})\n```\n\n### Presets and custom configuration\n\nThe pipe comes with a set of pre-defined sort options as shown below.\n\n| Option         | Examples (given in `en-US` locale) |\n|----------------|------------------------------------|\n| `'lowerFirst'` | `['a', 'e', 'z', 'Z']`             |\n| `'upperFirst'` | `['a', 'e', 'Z', 'z']`             |\n\n### API\n\n| Parameter    | Type                             | Description           |\n|--------------|----------------------------------|-----------------------|\n| `value`      | `string[] \\| null`               | The list of strings to be sorted. |\n| `options`    | `string \\| IntlSortLocalOptions` | The name of a preset or custom sort options. |\n| `...locales` | `string[]`                       | A list of locale overwrites. |\n\n### Browser compatibility\n\nSee [mdn web docs | Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator#browser_compatibility).\n\n## Code Contributors\n\nThis project exists thanks to all the people who contribute.\n\n\u003ca href=\"https://github.com/haiilo/ngx-intl/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=haiilo/ngx-intl\" /\u003e\n\u003c/a\u003e\n\n## License\n\nThe license is available within this repository in the\n[LICENSE](https://github.com/haiilo/ngx-intl/blob/main/LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaiilo%2Fngx-intl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaiilo%2Fngx-intl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaiilo%2Fngx-intl/lists"}