ember-intl
TypeScript icon, indicating that this package has built-in type declarations

6.4.1 • Public • Published

This project uses GitHub Actions for continuous integration. npm Ember Observer Score

ember-intl

Installation

ember install ember-intl
Use Glint or <template> tag? ✨
  • Update your template registry to extend this addon's. Check the Glint documentation for more information.

    /* types/index.d.ts */
    
    import '@glint/environment-ember-loose';
    
    import type EmberIntlRegistry from 'ember-intl/template-registry';
    
    declare module '@glint/environment-ember-loose/registry' {
      export default interface Registry extends EmberIntlRegistry, /* other addon registries */ {
        // local entries
      }
    }
  • If you are using <template> tag, you are good to go! Use the named import to consume things.

    /* app/components/hello.gts */
    import type { TOC } from '@ember/component/template-only';
    import { t } from 'ember-intl';
    
    interface HelloSignature {
      Args: {
        name: string;
      };
    }
    
    const HelloComponent: TOC<HelloSignature> =
      <template>
        <div data-test-message>
          {{t "hello.message" name=@name}}
        </div>
      </template>
    
    export default HelloComponent;

Notable Features

  • 💵 Locale-aware numbers. Formatting of currencies, decimals, and percentages
  • 📅 Locale-aware dates and times formatting
  • 🕑 Locale-aware display of relative time. i.e, "in 1 day", "2 years ago", etc.
  • 💬 ICU Message Syntax. Pluralization and formatted segments (numbers, datetime, etc.)
  • 🌐 Support for 150+ languages
  • 🕵🏻 Translation linting (detects missing translations & translation argument mismatches)
  • 📜 Built largely on standards. ICU message syntax & Native Intl API
  • ⚡ Extensive Ember Service API and template helpers for formatting and translating
  • 🎉 Advanced addon support to provide translations to the host app

Documentation

Compatibility

  • Ember.js v3.28 or above
  • Node.js v16 or above

Migrating from ember-i18n

There's an ember-i18n-to-intl-migrator tool that is used to convert your translations files and application code to ember-intl.

If you have any questions or issues, please open in ember-i18n-to-intl-migrator/issues

Package Sidebar

Install

npm i ember-intl

Weekly Downloads

60,014

Version

6.4.1

License

MIT

Unpacked Size

135 kB

Total Files

121

Last publish

Collaborators

  • caridy
  • ericf
  • kturney
  • jasonmit
  • buschtoens
  • turbo87
  • stefanpenner
  • longlho
  • ember-intl-bot
  • ijlee2