14 lines
503 B
CoffeeScript
14 lines
503 B
CoffeeScript
import Ember from 'ember'
|
|
|
|
# This function receives the params `params, hash`
|
|
export translate = (params, options) ->
|
|
path = params[0]
|
|
toptions = options
|
|
if params.length > 1 and typeof(params[1].toJSON) is 'function'
|
|
$.extend toptions, params[1].toJSON()
|
|
text = t(path, toptions)
|
|
tag = if options.bare then text else "<span data-t='#{path}' class='translation' data-t-attributes='#{JSON.stringify(toptions)}'>#{text}</span>"
|
|
tag.htmlSafe()
|
|
|
|
export default Ember.Helper.helper translate
|