From 792b2492dc053075ae1ede30b38f3c677e638eb2 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Fri, 30 Mar 2018 14:42:14 +0300 Subject: [PATCH] Modifications for Organic Maps --- lib/twine/formatters/android.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/twine/formatters/android.rb b/lib/twine/formatters/android.rb index 672e1e4..a6bdd98 100644 --- a/lib/twine/formatters/android.rb +++ b/lib/twine/formatters/android.rb @@ -7,6 +7,14 @@ module Twine class Android < Abstract include Twine::Placeholders + LANG_CODES = Hash[ + 'zh' => 'zh-Hans', + 'zh-CN' => 'zh-Hans', + 'zh-HK' => 'zh-Hant', + 'en-GB' => 'en-GB', + 'in' => 'id' + ] + def format_name 'android' end @@ -33,7 +41,10 @@ module Twine # see http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources match = /^values-([a-z]{2}(-r[a-z]{2})?)$/i.match(segment) - return match[1].sub('-r', '-') if match + if match + lang = match[1].sub('-r', '-') + return LANG_CODES.fetch(lang, lang) + end end end