mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Convert translation function to js
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
require('coffee-script');
|
||||
|
||||
var t = require('./translation.coffee');
|
||||
var t = require('./translation.js');
|
||||
|
||||
var faq = {};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ api = module.exports
|
||||
|
||||
_ = require 'lodash'
|
||||
moment = require 'moment'
|
||||
t = require './translation.coffee'
|
||||
t = require './translation.js'
|
||||
|
||||
###
|
||||
---------------------------------------------------------------
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
i18n = require '../i18n.coffee'
|
||||
t = (string, vars) ->
|
||||
func = (lang) ->
|
||||
vars ?= {a: 'a'}
|
||||
i18n.t(string, vars, lang)
|
||||
func.i18nLangFunc = true #Trick to recognize this type of function
|
||||
func
|
||||
|
||||
module.exports = t
|
||||
21
common/script/content/translation.js
Normal file
21
common/script/content/translation.js
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
require('coffee-script');
|
||||
var i18n = require('../i18n.coffee');
|
||||
|
||||
var t = function(string, vars) {
|
||||
var func = function(lang) {
|
||||
if (vars == null) {
|
||||
vars = {
|
||||
a: 'a'
|
||||
};
|
||||
}
|
||||
return i18n.t(string, vars, lang);
|
||||
};
|
||||
|
||||
func.i18nLangFunc = true; // Trick to recognize this type of function
|
||||
|
||||
return func;
|
||||
};
|
||||
|
||||
module.exports = t;
|
||||
Reference in New Issue
Block a user