Commit 9fd1d3ed authored by mercury233's avatar mercury233

test i18n

parent 54f06e4d
......@@ -18,6 +18,7 @@
"welcome": "MyCard YGOPro Server",
"update": "请更新游戏版本",
"stop": false,
"lang": "zh-cn",
"tips": {
"enabled": true,
"get": false
......
{
"en-us": {
"kicked_by_system": " is kicked by system.",
"random_duel_enter_room_waiting": "Your opponent is waiting for you, start duel now!",
"random_duel_enter_room_new": "entered new random duel room",
"random_duel_enter_room_match": "match mode, please use powerful deck"
},
"zh-cn": {
"kicked_by_system": " 被系统请出了房间",
"random_duel_enter_room_waiting": "对手已经在等你了,开始决斗吧!",
"random_duel_enter_room_new": "已建立随机对战房间,正在等待对手!",
"random_duel_enter_room_match": "您进入了比赛模式的房间,我们推荐使用竞技卡组!"
}
}
\ No newline at end of file
......@@ -77,7 +77,7 @@ ban_user = (name) ->
bad_ip = player.ip
ROOM_bad_ip[bad_ip]=99
settings.ban.banned_ip.push(player.ip)
ygopro.stoc_send_chat_to_room(room, "#{player.name} 被系统请出了房间", ygopro.constants.COLORS.RED)
ygopro.stoc_send_chat_to_room(room, "#{player.name}${kicked_by_system}", ygopro.constants.COLORS.RED)
player.destroy()
continue
return
......@@ -224,7 +224,7 @@ ROOM_find_or_create_random = (type, player_ip)->
(room.get_host() == null or room.get_host().ip != ROOM_players_oppentlist[player_ip]) and
(playerbanned == room.deprecated)
if result
result.welcome = '对手已经在等你了,开始决斗吧!'
result.welcome = '${random_duel_enter_room_waiting}'
#log.info 'found room', player_name
else if get_memory_usage() < 90
type = if type then type else 'S'
......@@ -232,12 +232,12 @@ ROOM_find_or_create_random = (type, player_ip)->
result = new Room(name)
result.random_type = type
result.max_player = max_player
result.welcome = '已建立随机对战房间,正在等待对手!'
result.welcome = '${random_duel_enter_room_new}'
result.deprecated = playerbanned
#log.info 'create room', player_name, name
else
return null
if result.random_type=='M' then result.welcome = result.welcome + '\n您进入了比赛模式的房间,我们推荐使用竞技卡组!'
if result.random_type=='M' then result.welcome = result.welcome + '\nrandom_duel_enter_room_match'
return result
ROOM_find_or_create_ai = (name)->
......@@ -843,6 +843,10 @@ ygopro.ctos_follow 'PLAYER_INFO', true, (buffer, info, client, server)->
struct.set("name", name)
buffer = struct.buffer
client.name = name
client.lang=settings.modules.lang
if name == "P233"
client.lang="en-us"
return false
ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
......
......@@ -102,7 +102,7 @@
bad_ip = player.ip;
ROOM_bad_ip[bad_ip] = 99;
settings.ban.banned_ip.push(player.ip);
ygopro.stoc_send_chat_to_room(room, player.name + " 被系统请出了房间", ygopro.constants.COLORS.RED);
ygopro.stoc_send_chat_to_room(room, player.name + "${kicked_by_system}", ygopro.constants.COLORS.RED);
player.destroy();
continue;
}
......@@ -310,20 +310,20 @@
return room && room.random_type !== '' && !room.started && ((type === '' && room.random_type !== 'T') || room.random_type === type) && room.get_playing_player().length < max_player && (room.get_host() === null || room.get_host().ip !== ROOM_players_oppentlist[player_ip]) && (playerbanned === room.deprecated);
});
if (result) {
result.welcome = '对手已经在等你了,开始决斗吧!';
result.welcome = '${random_duel_enter_room_waiting}';
} else if (get_memory_usage() < 90) {
type = type ? type : 'S';
name = type + ',RANDOM#' + Math.floor(Math.random() * 100000);
result = new Room(name);
result.random_type = type;
result.max_player = max_player;
result.welcome = '已建立随机对战房间,正在等待对手!';
result.welcome = '${random_duel_enter_room_new}';
result.deprecated = playerbanned;
} else {
return null;
}
if (result.random_type === 'M') {
result.welcome = result.welcome + '\n您进入了比赛模式的房间,我们推荐使用竞技卡组!';
result.welcome = result.welcome + '\nrandom_duel_enter_room_match';
}
return result;
};
......@@ -1060,6 +1060,10 @@
struct.set("name", name);
buffer = struct.buffer;
client.name = name;
client.lang = settings.modules.lang;
if (name === "P233") {
client.lang = "en-us";
}
return false;
});
......
......@@ -4,6 +4,8 @@ _.mixin(_.str.exports())
Struct = require('./struct.js').Struct
i18ns = require './i18n.json'
#常量/类型声明
structs_declaration = require './structs.json' #结构体声明
typedefs = require './typedefs.json' #类型声明
......@@ -116,6 +118,9 @@ for name, declaration of structs_declaration
for line in _.lines(msg)
if player>=10
line="[System]: "+line
for o,r of i18ns[client.lang]
re=new RegExp("\\$\\{"+o+"\\}",'g')
line=line.replace(re,r)
@stoc_send client, 'CHAT', {
player: player
msg: line
......
// Generated by CoffeeScript 1.12.1
(function() {
var Struct, _, declaration, field, i, len, name, result, structs_declaration, type, typedefs;
var Struct, _, declaration, field, i, i18ns, len, name, result, structs_declaration, type, typedefs;
_ = require('underscore');
......@@ -10,6 +10,8 @@
Struct = require('./struct.js').Struct;
i18ns = require('./i18n.json');
structs_declaration = require('./structs.json');
typedefs = require('./typedefs.json');
......@@ -167,7 +169,7 @@
};
this.stoc_send_chat = function(client, msg, player) {
var j, len1, line, ref;
var j, len1, line, o, r, re, ref, ref1;
if (player == null) {
player = 8;
}
......@@ -181,6 +183,12 @@
if (player >= 10) {
line = "[System]: " + line;
}
ref1 = i18ns[client.lang];
for (o in ref1) {
r = ref1[o];
re = new RegExp("\\$\\{" + o + "\\}", 'g');
line = line.replace(re, r);
}
this.stoc_send(client, 'CHAT', {
player: player,
msg: line
......
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