diff --git a/lib/twine/output_processor.rb b/lib/twine/output_processor.rb index 8924ad1..56f0747 100644 --- a/lib/twine/output_processor.rb +++ b/lib/twine/output_processor.rb @@ -13,6 +13,7 @@ module Twine 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 } diff --git a/lib/twine/twine_file.rb b/lib/twine/twine_file.rb index e875f3c..79ccc3d 100644 --- a/lib/twine/twine_file.rb +++ b/lib/twine/twine_file.rb @@ -44,7 +44,7 @@ module Twine 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