Skip to content

Instantly share code, notes, and snippets.

@manchunlam
Last active December 21, 2015 13:19
Show Gist options
  • Save manchunlam/6312256 to your computer and use it in GitHub Desktop.
Save manchunlam/6312256 to your computer and use it in GitHub Desktop.
Platform UI i18n

config/i18n-js.yml

translations:
  -
    # This key must match exactly
    file: 'public/javascripts/platform_ui/i18n/translations.js'

    # List the translation keys you want exported to JS here.
    # The leading * indicates all locales.  The first two sections
    # are required for bundle-picker and dialog support in PlatformUi.
    # If you list just "*", then all translations will be available in JS.
    only:
      - "*.platform_ui.bundle_picker"
      - "*.platform_ui.dialogs"
      - "*.js"

In the above file, the line

      - "*.js"

means to only extract translations under the key js (e.g. en.js.foo). If the project's config/locales/en.yml does not have the key js, change the line to

      - "*"

This will extract all keys from the en.yml file, and put it into platform_ui/i18n/#{locale}.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment