diff --git a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee index 56d1d0be9..8129929e5 100644 --- a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee @@ -7,12 +7,17 @@ class App.i18n @translateContent: ( string, args... ) -> if _instance == undefined _instance ?= new _Singleton - _instance.translate_content( string, args ) + _instance.translateContent( string, args ) + + @translatePlain: ( string, args... ) -> + if _instance == undefined + _instance ?= new _Singleton + _instance.translatePlain( string, args ) @translateInline: ( string, args... ) -> if _instance == undefined _instance ?= new _Singleton - _instance.translate_inline( string, args ) + _instance.translateInline( string, args ) @translateTimestamp: ( args ) -> if _instance == undefined @@ -116,11 +121,11 @@ class _Singleton extends Spine.Module App.Translation.refresh( { id: object[0], source: object[1], target: object[2], locale: @locale } ) ) - translate_inline: ( string, args... ) => - @translate( string, args... ) + translateInline: ( string, args... ) => + @escape( @translate( string, args... ) ) - translate_content: ( string, args... ) => - translated = @translate( string, args... ) + translateContent: ( string, args... ) => + translated = @escape( @translate( string, args... ) ) # replace = '' + translated + '' if App.Config.get( 'Translation' ) replace = '' + translated + '' @@ -130,6 +135,9 @@ class _Singleton extends Spine.Module else translated + translatePlain: ( string, args... ) => + @translate( string, args... ) + translate: ( string, args... ) => # return '' on undefined @@ -147,9 +155,6 @@ class _Singleton extends Spine.Module for arg in args translated = translated.replace(/%s/, arg) - # escape - translated = @escape(translated) - @log 'i18n', 'debug', 'translate', string, args, translated # return translated string