Skip to content

Commit

Permalink
Merge pull request scelis#304 from apascual/main
Browse files Browse the repository at this point in the history
Fixed fallback language support and included simplified Chinese
  • Loading branch information
scelis authored Jul 12, 2021
2 parents 7a77a55 + 790e3f7 commit 304b3ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/twine/output_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def default_language

def fallback_languages(language)
fallback_mapping = {
'zh-CN' => 'zh-Hans', # if we don't have a zh-CN translation, try zh-Hans before en
'zh-TW' => 'zh-Hant' # if we don't have a zh-TW translation, try zh-Hant before en
}

Expand Down
2 changes: 1 addition & 1 deletion lib/twine/twine_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def matches_tags?(tags, include_untagged)
end

def translation_for_lang(lang)
translation = [lang].flatten.map { |l| @translations[l] }.first
translation = [lang].flatten.map { |l| @translations[l] }.compact.first

translation = reference.translation_for_lang(lang) if translation.nil? && reference

Expand Down

0 comments on commit 304b3ec

Please sign in to comment.