-
Notifications
You must be signed in to change notification settings - Fork 8
Add localization support #10
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
Open
Caellian
wants to merge
7
commits into
typst-community:main
Choose a base branch
from
Caellian:feat/locales
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+159
−28
Open
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8fe3c98
Add localization support
Caellian 70b0c8f
Support called function name localization
Caellian 1fbe31c
Fix none return when l is applied to unsupported types
Caellian 62619b3
Switch csv with a typ file
Caellian 3061eda
Improve handling
Caellian 127a088
Hardcode english locale as default to remove context
Caellian da69e54
Merge remote-tracking branch 'upstream/main' into feat/locales
Caellian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#let locale = ( | ||
en: ( | ||
"Algorithm": "Algorithm", | ||
"function": "function", | ||
"procedure": "procedure", | ||
"if": "if", | ||
"then": "then", | ||
"else": "else", | ||
"else if": "else if", | ||
"for": "for", | ||
"do": "do", | ||
"while": "while", | ||
"end": "end", | ||
"return": "return", | ||
"terminate": "terminate", | ||
"break": "break", | ||
), | ||
de: ( | ||
"Algorithm": "Algorithmus", | ||
"function": "Funktion", | ||
"procedure": "Prozedur", | ||
"if": "wenn", | ||
"then": "dann", | ||
"else": "sonst", | ||
"else if": "else sonst wenn", | ||
"for": "für", | ||
"do": "ausführen", | ||
"while": "während", | ||
"end": "ende", | ||
"return": "zurückgeben", | ||
"terminate": "abbrechen", | ||
// "break": "break", usually not translated | ||
), | ||
hr: ( | ||
"Algorithm": "Algoritam", | ||
"function": "funkcija", | ||
"procedure": "procedura", | ||
"if": "ako", | ||
"then": "onda", | ||
"else": "inače", | ||
"else if": "inače ako", | ||
"for": "za", | ||
"do": "provedi", | ||
"while": "dok", | ||
"end": "kraj", | ||
"return": "vrati", | ||
"terminate": "terminiraj", | ||
"break": "prekid", | ||
), | ||
sr: ( | ||
"Algorithm": "Algoritam", | ||
"function": "funkcija", | ||
"procedure": "procedura", | ||
"if": "ako", | ||
"then": "onda", | ||
"else": "inače", | ||
"else if": "inače ako", | ||
"for": "za", | ||
"do": "provedi", | ||
"while": "dok", | ||
"end": "kraj", | ||
"return": "vrati", | ||
"terminate": "terminiraj", | ||
"break": "prekid", | ||
), | ||
cnr: ( | ||
"Algorithm": "Algoritam", | ||
"function": "funkcija", | ||
"procedure": "procedura", | ||
"if": "ako", | ||
"then": "onda", | ||
"else": "inače", | ||
"else if": "inače ako", | ||
"for": "za", | ||
"do": "provedi", | ||
"while": "dok", | ||
"end": "kraj", | ||
"return": "vrati", | ||
"terminate": "terminiraj", | ||
"break": "prekid", | ||
), | ||
bs: ( | ||
"Algorithm": "Algoritam", | ||
"function": "funkcija", | ||
"procedure": "procedura", | ||
"if": "ako", | ||
"then": "onda", | ||
"else": "inače", | ||
"else if": "inače ako", | ||
"for": "za", | ||
"do": "uradi", | ||
"while": "dok", | ||
"end": "kraj", | ||
"return": "vrati", | ||
"terminate": "terminiraj", | ||
"break": "prekid", | ||
), | ||
sl: ( | ||
"Algorithm": "Algoritem", | ||
"function": "funkcija", | ||
"procedure": "procedura", | ||
"if": "če", | ||
"then": "potem", | ||
"else": "drugače", | ||
"else if": "drugače če", | ||
"for": "za", | ||
"do": "izvedi", | ||
"while": "dokler", | ||
"end": "konec", | ||
"return": "vrni", | ||
"terminate": "prekini", | ||
"break": "izstopi", | ||
) | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
supplement should be "Algorithm" by default, not none.
Uh oh!
There was an error while loading. Please reload this page.
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.
none
means none is specified explicitly, so it'll use default localization. This way you can still specify something like "Derp" without the rest of the code trying to localize that.In docs you'd state the default is "Algorithm" as you did previously.
EDIT: Right, with keeping "en" the default, doing this doesn't make the API nicer. I'll make a commit addressing this review, as it's isolated to these changes it should be straightforward enough to simply revert it for 2.0.0.