Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-cli-pod-translations

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-pod-translations

An addon to compile your locale files inside pods.

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ember-cli-pod-translations

Build Status

An addon to compile your locale files inside pods.

Installation

$ ember install ember-cli-pod-translations

Usage

  1. Create translation files for your components, controllers or routes

    For example, we could create an english file app/pods/components/x-foo/translations.en.json

    {
      "hello_world": "Hello World"
    }
    

    Then a french file app/pods/components/x-foo/translations.fr.json:

    {
      "hello_world": "Bonjour le monde"
    }
    
  2. Extend your component, controller or route with the Localizable mixin

    NOTE: This is required for both the JS and template usage

    // app/pods/components/x-foo/component.js
    
    import Ember from 'ember';
    import Localizable from 'ember-cli-pod-translations/mixins/localizable';
    import translations from './translations';
    
    export default Ember.Component.extend(Localizable(translations));
    
  3. Use your translations in your Ember object

    // app/pods/components/x-foo/component.js
    
    import Ember from 'ember';
    import Localizable from 'ember-cli-pod-translations/mixins/localizable';
    import translations from './translations';
    
    export default Ember.Component.extend(Localizable(translations), {
      helloString: computed(function() {
        return this.localTranslation('hello_world');
      })
    });
    
  4. Use your translations in your template

    {{!-- app/pods/components/x-foo/template.hbs --}}
    
    {{local-t localizablePrefix 'hello_world'}}
    
    You can also use a "raw" translation which is not wrapped in a SafeString for ember-moment for example:
    
    {{moment-format date (local-t-raw localizablePrefix 'date_format')}}
    

Contributing

$ git clone https://github.com/mirego/ember-cli-pod-translations
$ cd ember-cli-pod-translations
$ yarn install

Running the dummy app

$ ember serve

Visit your app at http://localhost:4200.

Running tests

$ npm test # Runs `ember try:each` to test the addon against multiple Ember versions
$ ember test
$ ember test --server

Building

$ ember build

For more information on using ember-cli, visit https://ember-cli.com/.

License

ember-cli-pod-translations is © 2017 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.

Keywords

FAQs

Package last updated on 14 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc