From ee8a4333fdb125bd3ba5eb78c275eeb2d1480c83 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 3 Aug 2014 23:07:51 +0200 Subject: [PATCH] Improved error handling. --- .../javascripts/app/lib/app_post/i18n.js.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 5e3b17761..5840c1c8b 100644 --- a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee @@ -143,19 +143,22 @@ class _i18nSingleton extends Spine.Module translate: ( string, args... ) => + # type convertation + if typeof string isnt 'string' + if string && string.toString + string = string.toString() + # return '' on undefined - if typeof string is 'boolean' - string = string.toString() return '' if string is undefined return '' if string is '' # return translation if @map[string] isnt undefined @_translated = true - translated = @map[string] + translated = @map[string] else @_translated = false - translated = string + translated = string # search %s for arg in args