全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2322|回复: 12

[经验] 自己翻的WHMCS 6.2语言包

[复制链接]
发表于 2016-1-4 22:25:41 | 显示全部楼层 |阅读模式
本帖最后由 小羊 于 2016-1-4 22:28 编辑

好吧其实连作业都没写。。就在这翻译2333

pan.baidu.com/s/1mgYGbeo

【仅前台!!】

因为之前只有5.x的翻译包,然后就写了个C#代码自动跑翻译
结果依然还有30%没翻译。。就自己手翻了。
居然卡死循环QAQ




PS::D:\chinese.php是5.x的语言包,D:\simplified.php是english.php复制一份过来的
有大神帮忙完善一下翻译和这个自动从现有源翻译的小工具吗QAQ

StreamReader file = new StreamReader("D:\\simplified.php", Encoding.UTF8);
string source = file.ReadToEnd();
StreamReader file_trans = new StreamReader("D:\\chinese.php", Encoding.UTF8);
string trans = file_trans.ReadToEnd();
trans = trans.Replace("\r\n", "\n");
int next_position = source.IndexOf("$_LANG");
while (next_position != -1)
{
    int next_equal = source.IndexOf("] = \"", next_position);
    int value_end = source.IndexOf("\";", next_equal);
    string item = source.Substring(next_position, value_end - next_position + 2);
    string prepose = source.Substring(next_position, next_equal - next_position + 4);
    int item_found = trans.IndexOf(prepose);
    if (item_found != -1)
    {
        int item_end = trans.IndexOf("\";", item_found);
        string item_to_be_replaced = trans.Substring(item_found, item_end - item_found + 2);
        source = source.Replace(item, item_to_be_replaced);
        next_position = source.IndexOf(item_to_be_replaced) + item_to_be_replaced.Length;
        next_position = source.IndexOf("$_LANG", next_position);
    }
    else
    {
        next_position = source.IndexOf("$_LANG", next_position + item.Length);
    }
}
StreamWriter file2 = new StreamWriter("D:\\translated.php", false, Encoding.UTF8);
file2.Write(source);
file2.Dispose();
Console.WriteLine(source);
发表于 2016-1-4 22:26:35 | 显示全部楼层
不错,不管了,点个赞再说,楼主再接再厉
发表于 2016-1-4 22:33:27 | 显示全部楼层
不错,不管了,点个赞再说,楼主再接再厉
发表于 2016-1-4 22:43:55 | 显示全部楼层
表扬楼主!点赞!
发表于 2016-1-4 22:45:43 | 显示全部楼层
来个6.X的模板吧
发表于 2016-1-4 22:57:24 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2016-1-4 22:57:50 | 显示全部楼层
不错,不管了,点个赞再说,楼主再接再厉
发表于 2016-1-5 00:22:42 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2016-1-5 01:03:39 来自手机 | 显示全部楼层
不错,不管了,点个赞再说,楼主再接再厉
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-30 06:33 , Processed in 0.069940 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表