-
Notifications
You must be signed in to change notification settings - Fork 57
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 names for 2 letter codes #572
Merged
bittlingmayer
merged 8 commits into
machinetranslate:master
from
tovmasharrison:add-names-for-2-letter-codes
Dec 5, 2023
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4adb46f
Remove unlisted languages and add names for 2 letter codes
7378f60
Add names for 2 letter codes
9b66457
Remove unlisted languages and add names for 2 letter codes
cb6140a
Add names for 2 letter codes
1c30f36
Merge branch 'add-names-for-2-letter-codes' of https://github.com/tov…
1b7f258
Add 3-letter codes along with the 2-letter codes and change slugify t…
f436976
Add language codes for Chinese
0de6169
Modify language code capitalization
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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 |
---|---|---|
|
@@ -213,7 +213,7 @@ def normalize(code): | |
base_code = base_language_code(normalized_code) | ||
if base_code in language['codes']: | ||
language_name = language.get('names', [None])[0] | ||
language_slug = slugify(language_name) if language_name else code | ||
language_slug = slugify(language_name) if language_name else base_code | ||
break | ||
if api_id not in [ 'alibaba', 'baidu', 'niutrans' ] and len(base_code) == 2 and not language_name: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make this stricter now? e.g.
|
||
# This is usually a typo. | ||
|
@@ -228,10 +228,10 @@ def normalize(code): | |
'variant_name': variant_name | ||
}) | ||
if not language_slug: | ||
if code in UNLISTED_LANGUAGES: | ||
UNLISTED_LANGUAGES[code] += 1 | ||
if base_code in UNLISTED_LANGUAGES: | ||
UNLISTED_LANGUAGES[base_code] += 1 | ||
else: | ||
UNLISTED_LANGUAGES[code] = 1 | ||
UNLISTED_LANGUAGES[base_code] = 1 | ||
|
||
integrations = get_tms_by_id_and_key(api_id, 'api_integrations') | ||
|
||
|
@@ -326,6 +326,7 @@ def normalize(code): | |
{ content } | ||
''') | ||
|
||
|
||
### Add unlisted languages to languages.json | ||
for code, _ in UNLISTED_LANGUAGES.items(): | ||
unlisted_languages = { | ||
|
This file contains 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
Oops, something went wrong.
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.
What does this change mean? For which languages does it change something? e.g Chinese?
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.
At the moment, the change doesn't make any difference since I have also added the names for 2-letter codes. However, I just changed it to
base_code
since the validation was done withbase_code
.