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] Change helpdb location w/o rebuilding system image #2498

Closed
wlbksy opened this issue Mar 7, 2013 · 13 comments
Closed

[i18n] Change helpdb location w/o rebuilding system image #2498

wlbksy opened this issue Mar 7, 2013 · 13 comments
Labels
domain:docs This change adds or pertains to documentation

Comments

@wlbksy
Copy link
Contributor

wlbksy commented Mar 7, 2013

I'm working on generating an Simplified Chinese helpdb_zh_CN.jl.
But when I put it in the same location of helpdb.jl and change base\util.jl 's

helpdb = evalfile("$JULIA_HOME/../share/julia/helpdb.jl")

into

helpdb = evalfile("$JULIA_HOME/../share/julia/helpdb_zh_CN.jl")

then restart REPL ,type help(), it echoes

ERROR: could not open file D:\soft\julia\bin\/../share/julia/helpdb.jl

Maybe this path &name have been hard coded into sys.ji ?

Could it be alted so that users can set local locale?
If not, users have to rename their helpdb_what_ever_language.jl to helpdb.jl and replace the origin one.

@pao
Copy link
Member

pao commented Mar 7, 2013

Yes, the things in base get stuffed into the system image. You can change that line, but you have to also make again.

However, i18n is a good argument for doing something different here.

@JeffBezanson
Copy link
Sponsor Member

I assume it should be changed to determine the file name at run time based on locale?

@pao
Copy link
Member

pao commented Mar 7, 2013

That sounds like a viable option, as long as there is a fallback to _en.

@nolta
Copy link
Member

nolta commented Mar 7, 2013

@wlbksy Could you post the output of the following:

bytestring(ccall(:setlocale, Ptr{Uint8}, (Int32,Ptr{Uint8}), 0, C_NULL))

?

@wlbksy
Copy link
Contributor Author

wlbksy commented Mar 8, 2013

@nolta

on Ubuntu "zh_CN.UTF-8"

useful string "zh_CN"

on Win7

"LC_COLLATE=Chinese (Simplified)_People's Republic of China.936;LC_CTYPE=Chinese
 (Simplified)_People's Republic of China.936;LC_MONETARY=Chinese (Simplified)_Pe
ople's Republic of China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_People's
Republic of China.936"

useful string "936" . see http://en.wikipedia.org/wiki/Codepage

If we are going to use locale environment variable, we should write OS specific expr.

[edit to specific things]

@nolta
Copy link
Member

nolta commented Mar 8, 2013

I've added preliminary support for this. You just have to copy your version of helpdb.jl into $JULIA_HOME/../share/julia/zh_CN/ and then run:

julia> Base.locale("zh_CN")
"zh_CN"

julia> help(int)
...

@wlbksy
Copy link
Contributor Author

wlbksy commented Mar 8, 2013

I'll make a new Julia, and report back.

@nolta
Copy link
Member

nolta commented Mar 8, 2013

Note to self: looks like GetUserDefaultLocaleName is the windows function for BCP 47 locales.

@wlbksy
Copy link
Contributor Author

wlbksy commented Mar 8, 2013

@nolta
Your commit works.
But it would be better if we could refresh loaded helpdb cache each time we call Base.locale
(help_category_dict is a must,
help_category_list,help_module_dict,and help_function_dict is optional).

Since this works, I'll close #2499

@wlbksy
Copy link
Contributor Author

wlbksy commented Mar 13, 2013

Can we close this?

@nolta nolta closed this as completed Mar 13, 2013
@ViralBShah
Copy link
Member

The README needs to be updated with sphinx as a dependency.

@wlbksy
Copy link
Contributor Author

wlbksy commented Mar 13, 2013

I don't think it is a dependency for now.

As for what you have said, there's an issue for it. #2501

@ViralBShah
Copy link
Member

Ok - I mixed up things. There was an issue on the debian julia-pkg-devel list about using sphinx. I am guessing that this is because the debian package uses sphinx as part of its build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation
Projects
None yet
Development

No branches or pull requests

5 participants