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

i18n包中的init函数是如何保证顺序的 #40

Closed
woshihuo12 opened this issue Aug 20, 2019 · 7 comments
Closed

i18n包中的init函数是如何保证顺序的 #40

woshihuo12 opened this issue Aug 20, 2019 · 7 comments

Comments

@woshihuo12
Copy link

如题,包中的源文件都包含init函数,但谁先谁后有什么注意的地方?

@davyxu
Copy link
Owner

davyxu commented Aug 20, 2019

init不保证顺序

@woshihuo12
Copy link
Author

那其中一个默认设为英文的那个init就是多余的,或者说是不对的

@davyxu
Copy link
Owner

davyxu commented Aug 20, 2019

贴出代码来

@davyxu
Copy link
Owner

davyxu commented Aug 20, 2019

如果是不对的, 请证明. SetLanguage只有1个地方在调用, 而且有默认值

@woshihuo12
Copy link
Author

func init() {
SetLanguage("en_us")
}

i18n 模块中的这个init函数,字面意思难道不需要en_us的模块的init函数先行调用么。
当然可能由于e在i前面造成事实确实不会出错误。

@davyxu
Copy link
Owner

davyxu commented Aug 21, 2019

en_us和i18n在一个模块...

@woshihuo12
Copy link
Author

但是那个模块有3个init函数

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