Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

企业级应用的国际化解决方案(前端部分) #158

Open
GuoYongfeng opened this issue Nov 30, 2016 · 1 comment
Open

企业级应用的国际化解决方案(前端部分) #158

GuoYongfeng opened this issue Nov 30, 2016 · 1 comment

Comments

@GuoYongfeng
Copy link
Member

GuoYongfeng commented Nov 30, 2016

企业级应用的国际化解决方案

随着业务的对外发展,应用的国际化解决方案提上日程,本文仅限于应用前端开发部分的国际化方案讨论

需求及待解决问题

  • 整站资源的多语言编译:html/js/css/json
  • 数据传输的多语
  • 前端公共框架和插件的多语
  • 上下文context(后端负责)

参考示例

https://github.com/GuoYongfeng/i18n-webpack-demos

技术方案

i18next: internationalization ecosystem

基于i18next的国际化方案:http://i18next.com/docs/

webpack的i18n-webpack-plugin插件

示例代码

var path = require("path");
var I18nPlugin = require("i18n-webpack-plugin");
var languages = {
    "en": null,
    "de": require("./de.json")
};
module.exports = Object.keys(languages).map(function(language) {
    return {
        name: language,
        entry: "./example",
        output: {
            path: path.join(__dirname, "js"),
            filename: language + ".output.js"
        },
        plugins: [
            new I18nPlugin(
                languages[language]
            )
        ]
    };
});

更多信息:

@songhlc
Copy link

songhlc commented Dec 1, 2016

现有需求
1.使用requirejs ,且使用了webpack
2.使用了requirejs,没有使用webpack
3.使用了webpack + es6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants