Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/twine.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Celis <sebastian@sebastiancelis.com>2017-08-04 16:13:49 +0300
committerGitHub <noreply@github.com>2017-08-04 16:13:49 +0300
commit1789a59bc1bfb273c3207622dda73813404c6c22 (patch)
tree35ca5ce04d0234186e0c91dc955168a5ace34ef5
parentcd28717f92ce20106bc822f5c9e11a83657dcb23 (diff)
parent9d75f104dfce2f7d68213bf0714d74b25bb9f05a (diff)
Merge pull request #203 from scelis/fix/android-output-folder-name
Fix android output folder name
-rw-r--r--lib/twine/formatters/android.rb4
-rw-r--r--test/test_formatters.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/twine/formatters/android.rb b/lib/twine/formatters/android.rb
index 0108de8..b9dba3e 100644
--- a/lib/twine/formatters/android.rb
+++ b/lib/twine/formatters/android.rb
@@ -32,7 +32,7 @@ module Twine
# The language is defined by a two-letter ISO 639-1 language code, optionally followed by a two letter ISO 3166-1-alpha-2 region code (preceded by lowercase "r").
# 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
end
end
@@ -41,7 +41,7 @@ module Twine
end
def output_path_for_language(lang)
- "values-#{lang}"
+ "values-#{lang}".gsub(/-(\p{Lu})/, '-r\1')
end
def set_translation_for_key(key, lang, value)
diff --git a/test/test_formatters.rb b/test/test_formatters.rb
index ae10a69..a63b0a5 100644
--- a/test/test_formatters.rb
+++ b/test/test_formatters.rb
@@ -157,6 +157,10 @@ class TestAndroidFormatter < FormatterTest
def test_output_path_is_prefixed
assert_equal 'values-en', @formatter.output_path_for_language('en')
end
+
+ def test_output_path_with_region
+ assert_equal 'values-en-rGB', @formatter.output_path_for_language('en-GB')
+ end
end
class TestAppleFormatter < FormatterTest