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

Add zh_CN locale to build #357

Closed
chenweiyj opened this issue Aug 26, 2016 · 5 comments
Closed

Add zh_CN locale to build #357

chenweiyj opened this issue Aug 26, 2016 · 5 comments
Labels
feature Priority: 2

Comments

@chenweiyj
Copy link

Is it possible to point it out in package.json?

@adam-lynch
Copy link
Contributor

I'm not sure. @evshiron, do you know?

@evshiron
Copy link

Sorry but I have no idea what that "zh_CN locale" means. The files in locales directory?

@nurishi
Copy link
Contributor

nurishi commented Nov 3, 2016

I have some input with my findings on this topic.

If it's about OSX sdk build, I guess the root cause is the same as mine which I already have a patch as pull request #389. The issue for me is when we package the app with nw-builder, all the locales directories are deleted which are originally existing in nwjs (Tested with 3.1.2).

My patch is to retain locale directories instead but only deleting files inside so that multi local support is still available to the apps packaged by nw-builder.

There's nothing you can do in package.json if the locale directories are already dropped off.

If it's about OSX/Win normal builds, the issue will be different and the problem is on nwjs side that it lacks locales folders other than 'en' in their official build(checked with 0.14.7). However, we want nw-builder to always retain the locales regardless of those flavours.

Hope it helps.

@fritx
Copy link

fritx commented Nov 28, 2016

[1128] nw18 解决locale判断失效
#357
12升18 应用打包后 navigator.language(s)始终返回en
(1) 可以确保nw Resources/下的*.lproj语言文件 cp到打包后的app内
language(s)重新生效 像nw12一样

nw.build()
.then(() => {
  // mac
  ;['en', 'zh_CN', 'zh_TW'].forEach(k => {
    const d = `../regt-app/Genie/osx64/Genie.app/Contents/Resources/${k}.lproj`
    fs.outputFileSync(d, '')
  })
})

(2) 也可以考虑引入os-locale这个库
https://github.com/sindresorhus/os-locale
但它在win上调用的wmic有可能是未加入path 甚至是不存在
需要注意 并且调用耗时

if (IS_WIN) {
  const winPath = process.env.windir || process.env.WINDIR
  const wmicPath = winPath + '\\system32\\webm'
  process.env.PATH = [wmicPath, process.env.PATH].join(';')
}
try {
  return require('os-locale').sync()
} catch (e) {
  return 'en'
}

@ayushmanchhabra ayushmanchhabra changed the title How to add zh_CN locale to my build? Add zh_CN locale to build May 18, 2022
@ayushmanchhabra ayushmanchhabra added feature Priority: 2 and removed needinfo labels May 18, 2022
@ayushmanchhabra
Copy link
Collaborator

@chenweiyj Closing this for now. Let me know if you still want this feature.

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

No branches or pull requests

6 participants