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-10-14 00:53:16 +0300
committerGitHub <noreply@github.com>2017-10-14 00:53:16 +0300
commit960431ce52a336aeb34899d474dac3995a5bbc0d (patch)
tree93409ed28336f0ed83bf7f4211d688aec4b6c598
parent922f1a72a150e460fc4f526f1fa228772e9917c0 (diff)
parent86cf20478b399483b0f8813d30fc9c8b9019ddef (diff)
Merge pull request #219 from philippeauriach/apple-base-language-option
use developer-language option for apple Base folder
-rw-r--r--.gitignore1
-rw-r--r--lib/twine/formatters/apple.rb4
-rw-r--r--test/test_formatters.rb12
3 files changed, 15 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 1c1d03a..6536339 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
.idea/
*.lock
.ruby-version
+.DS_Store
diff --git a/lib/twine/formatters/apple.rb b/lib/twine/formatters/apple.rb
index 44ce7a4..5233cb1 100644
--- a/lib/twine/formatters/apple.rb
+++ b/lib/twine/formatters/apple.rb
@@ -22,7 +22,9 @@ module Twine
path_arr.each do |segment|
match = /^(.+)\.lproj$/.match(segment)
if match
- if match[1] != "Base"
+ if match[1] == "Base"
+ return @options[:developer_language]
+ else
return match[1]
end
end
diff --git a/test/test_formatters.rb b/test/test_formatters.rb
index ae30787..87658b7 100644
--- a/test/test_formatters.rb
+++ b/test/test_formatters.rb
@@ -39,7 +39,7 @@ end
class TestAndroidFormatter < FormatterTest
def setup
super Twine::Formatters::Android
-
+
@escape_test_values = {
'this & that' => 'this &amp; that',
'this < that' => 'this &lt; that',
@@ -193,6 +193,16 @@ class TestAppleFormatter < FormatterTest
assert_file_contents_read_correctly
end
+ def test_deducts_language_from_resource_folder
+ language = %w(en de fr).sample
+ assert_equal language, @formatter.determine_language_given_path("#{language}.lproj/Localizable.strings")
+ end
+
+ def test_deducts_base_language_from_resource_folder
+ @formatter.options = { consume_all: true, consume_comments: true, developer_language: 'en' }
+ assert_equal 'en', @formatter.determine_language_given_path('Base.lproj/Localizations.strings')
+ end
+
def test_reads_quoted_keys
@formatter.read StringIO.new('"key" = "value"'), 'en'
assert_equal 'value', @empty_twine_file.definitions_by_key['key'].translations['en']