Commit c8f29f66 authored by nanahira's avatar nanahira

public i18n

parent 4064d0fc
...@@ -5,7 +5,7 @@ _.mixin(_.str.exports()) ...@@ -5,7 +5,7 @@ _.mixin(_.str.exports())
Struct = require('./struct.js').Struct Struct = require('./struct.js').Struct
loadJSON = require('load-json-file').sync loadJSON = require('load-json-file').sync
i18ns = loadJSON './data/i18n.json' @i18ns = loadJSON './data/i18n.json'
#常量/类型声明 #常量/类型声明
structs_declaration = loadJSON './data/structs.json' #结构体声明 structs_declaration = loadJSON './data/structs.json' #结构体声明
...@@ -152,7 +152,7 @@ for name, declaration of structs_declaration ...@@ -152,7 +152,7 @@ for name, declaration of structs_declaration
for line in _.lines(msg) for line in _.lines(msg)
if player>=10 if player>=10
line="[Server]: "+line line="[Server]: "+line
for o,r of i18ns[client.lang] for o,r of @i18ns[client.lang]
re=new RegExp("\\$\\{"+o+"\\}",'g') re=new RegExp("\\$\\{"+o+"\\}",'g')
line=line.replace(re,r) line=line.replace(re,r)
@stoc_send client, 'CHAT', { @stoc_send client, 'CHAT', {
......
// Generated by CoffeeScript 1.12.7 // Generated by CoffeeScript 1.12.7
(function() { (function() {
var Struct, _, declaration, field, i, i18ns, len, loadJSON, name, result, structs_declaration, type, typedefs; var Struct, _, declaration, field, i, len, loadJSON, name, result, structs_declaration, type, typedefs;
_ = require('underscore'); _ = require('underscore');
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
loadJSON = require('load-json-file').sync; loadJSON = require('load-json-file').sync;
i18ns = loadJSON('./data/i18n.json'); this.i18ns = loadJSON('./data/i18n.json');
structs_declaration = loadJSON('./data/structs.json'); structs_declaration = loadJSON('./data/structs.json');
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
if (player >= 10) { if (player >= 10) {
line = "[Server]: " + line; line = "[Server]: " + line;
} }
ref1 = i18ns[client.lang]; ref1 = this.i18ns[client.lang];
for (o in ref1) { for (o in ref1) {
r = ref1[o]; r = ref1[o];
re = new RegExp("\\$\\{" + o + "\\}", 'g'); re = new RegExp("\\$\\{" + o + "\\}", 'g');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment