-
Notifications
You must be signed in to change notification settings - Fork 16
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
Internationalization #14
Conversation
src/i18n.jl
Outdated
present_str(lang::Lang) where {Lang <: English} = "present" | ||
present_mode_str(lang::Lang) where {Lang <: English} = "Present Mode" | ||
|
||
default_language = Ref{AbstractLanguage}(EnglishUS()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a frequent user of references in Julia. Would you mind explaining why you used one here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was mainly based on this comment. When looking deeper into this, I could not find details on this. I am also not sure how much penalty we get by having this variable type Any. With Julia 1.8, we could also directly annotate the type to avoid the instability but this would break compatibility with older Julia versions.
Thanks. I skimmed it and think this looks very promising. I asked some questions where I wasn't sure about the pros/cons of the different ways we could implement something. In order to minimize the risk of breaking changes in the future, I think it would be good to have at least one other language implemented before we merge the changes. That way we'll be more likely to notice any complications that we should address now. |
Thanks for the quick review. The draft was mainly meant to inform you where I am doing stuff, but I think I now addressed all the issues. The tests are running through and after setting the language, I get the correct translations. From my perspective we can merge. What do you think? |
Thanks! I tried using it with one of the notebooks for my current class. I got several error messages like
So far, all the problems I noticed could be traced to a function where a (currently) required argument has a default value. In the PR, the default value is set by a function call that depends on lang, but lang is only set in a subsequent argument. For example correct(text=rand(yays(lang)), lang::AbstractLanguage = default_language[]) = Markdown.MD(Markdown.Admonition("correct", correct_str(lang), [text])); The other cases I noticed were
correct(; lang::AbstractLanguage = default_language[], text=rand(yays(lang)) ) = Markdown.MD(Markdown.Admonition("correct", correct_str(lang), [text])); Pros:
Cons:
Open Question:
correct(; lang::AbstractLanguage = default_language[], text=rand(yays(lang)) ) = Markdown.MD(Markdown.Admonition("correct", correct_str(lang), [text]));
correct(text, lang::AbstractLanguage = default_language[]) = correct(;lang=lang, text=text) Pros:
Cons:
Currently, I'm leaning towards option #2. |
I now opted for option 2 and implemented it. Those few more lines should not be hard to maintain. I now also added a separation between formal and colloquial German. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Closes #13