Sha256: 7e4d6b01408fdc0771609734fa18916a1d3a09eb5fef8c78419cd1aeef84bfcc

Contents?: true

Size: 784 Bytes

Versions: 26

Compression:

Stored size: 784 Bytes

Contents

#= require alchemy/alchemy.translations

window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'

Alchemy.I18n =

  # Translates given string
  #
  translate: (key, replacement) ->
    if !Alchemy.locale?
      throw 'Alchemy.locale is not set! Please set Alchemy.locale to a locale string in order to translate something.'
    translations = Alchemy.translations[Alchemy.locale]
    if translations
      translation = translations[key] || key
      if replacement
        translation.replace(/%\{.+\}/, replacement)
      else
        translation
    else
      Alchemy.debug "Translations for locale #{Alchemy.locale} not found!"
      key

# Global utility method for translating a given string
#
Alchemy._t = (key, replacement) ->
  Alchemy.I18n.translate(key, replacement)

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.3 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
lc_alchemy_cms-3.2.1 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
lc_alchemy_cms-3.2.0 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.2.0 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.2.0.rc1 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.2.0.beta app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.1 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.0.4 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.rc3 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.rc2 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.rc1 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.beta6 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.beta5 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.beta4 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.0.3 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.beta3 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.beta2 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee
alchemy_cms-3.1.0.beta1 app/assets/javascripts/alchemy/alchemy.i18n.js.coffee