Skip to content

Create a mapping from script to font language#767

Merged
jwiggins merged 1 commit into
masterfrom
feature/language-mapping
Apr 6, 2021
Merged

Create a mapping from script to font language#767
jwiggins merged 1 commit into
masterfrom
feature/language-mapping

Conversation

@jwiggins
Copy link
Copy Markdown
Member

This is another step for #762

The PR adds support for converting the script name generated by UnicodeAnalyzer and mapping it to a language name which a font reports support for.

@rahulporuri rahulporuri self-requested a review March 31, 2021 02:03
Copy link
Copy Markdown
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +41 to +48
# Pick a language to use for "Han" script
han_lang = "Traditional Chinese" # Default
if locale_lang in ("zh_CN", "zh_SG"):
han_lang = "Simplified Chinese"
elif locale_lang.startswith("ja"):
han_lang = "Japanese"
elif locale_lang.startswith("ko"):
han_lang = "Korean"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having played with this a bit more, we should only use this choice when it's not otherwise clear from the context. For instance if a string already contains Hiragana or Katakana, then Han should be mapped to "Japanese". If Hangul is encountered, Han maps to "Korean". Only if the Han is mixed with some non-CJK language should we fall back to this locale-based guess.

@jwiggins jwiggins merged commit aaf25fe into master Apr 6, 2021
@jwiggins
Copy link
Copy Markdown
Member Author

jwiggins commented Apr 6, 2021

Thanks for the review

@jwiggins jwiggins deleted the feature/language-mapping branch April 6, 2021 08:59
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

Successfully merging this pull request may close these issues.

2 participants