Skip to content

Commit

Permalink
Merge pull request #16 from alvarotrigo/patch-2
Browse files Browse the repository at this point in the history
Added interpolateSelector option
  • Loading branch information
Daniel Perez authored Dec 6, 2017
2 parents e027727 + 6242cb4 commit ad91ad3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ S = require 'string'
defaults =
selector: '[data-t]'
attrSelector: '[data-attr-t]',
interpolateSelector: '[data-t-interpolate]',
attrInterpolateSelector: '[data-attr-t-interpolate]',
useAttr: true
replace: false
Expand Down Expand Up @@ -125,6 +126,9 @@ translateElem = ($, elem, options, t) ->
if options.allowHtml
$elem.html(trans)
else
if $elem.filter(options.interpolateSelector).length
trans = trans.replace /{{([^{}]*)}}/g, (aa, bb) ->
return t(bb)
$elem.text(trans)

getPath = (fpath, locale, options) ->
Expand Down

0 comments on commit ad91ad3

Please sign in to comment.