diff --git a/assets/scripts/lib/ext/i18n.coffee b/assets/scripts/lib/ext/i18n.coffee new file mode 100644 index 00000000..5eec7d69 --- /dev/null +++ b/assets/scripts/lib/ext/i18n.coffee @@ -0,0 +1,5 @@ +I18n.missingTranslation = -> + key = arguments[arguments.length - 1] + value = key.split('.').pop() + $.titleize(value) + diff --git a/assets/scripts/lib/ext/jquery.coffee b/assets/scripts/lib/ext/jquery.coffee index 8e9a24cb..37930a9e 100644 --- a/assets/scripts/lib/ext/jquery.coffee +++ b/assets/scripts/lib/ext/jquery.coffee @@ -64,6 +64,10 @@ $.extend string[0].toLowerCase() + string.substring(1).replace /([A-Z])?/g, (match, chr) -> if chr then "_#{chr.toUpperCase()}" else '' + titleize: (string) -> + $.capitalize(string).replace /_(.)?/g, (match, chr) -> + if chr then ' ' + chr.toUpperCase() else '' + camelize: (string, uppercase) -> string = if uppercase == false then $.underscore(string) else $.capitalize(string) string.replace /_(.)?/g, (match, chr) -> diff --git a/assets/scripts/travis.coffee b/assets/scripts/travis.coffee index b0902091..6e1430bf 100644 --- a/assets/scripts/travis.coffee +++ b/assets/scripts/travis.coffee @@ -71,6 +71,7 @@ if window.history.state == undefined @store = app.store $ => app.initialize() +require 'ext/i18n' require 'travis/ajax' require 'app'