From 828aac3b37ce4f87d9ac2174d64d736111e2b926 Mon Sep 17 00:00:00 2001 From: Scott Weber Date: Tue, 21 Feb 2012 16:38:14 -0500 Subject: [PATCH] for android, put default language in values folder --- lib/twine/formatters/android.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/twine/formatters/android.rb b/lib/twine/formatters/android.rb index 449490c..09ae216 100644 --- a/lib/twine/formatters/android.rb +++ b/lib/twine/formatters/android.rb @@ -24,7 +24,7 @@ module Twine ] def self.can_handle_directory?(path) - Dir.entries(path).any? { |item| /^values-.+$/.match(item) } + Dir.entries(path).any? { |item| /^values.*$/.match(item) } end def default_file_name @@ -34,12 +34,16 @@ module Twine def determine_language_given_path(path) path_arr = path.split(File::SEPARATOR) path_arr.each do |segment| - match = /^values-(.*)$/.match(segment) - if match - lang = match[1] - lang = LANG_CODES.fetch(lang, lang) - lang.sub!('-r', '-') - return lang + if segment == 'values' + return @strings.language_codes[0] + else + match = /^values-(.*)$/.match(segment) + if match + lang = match[1] + lang = LANG_CODES.fetch(lang, lang) + lang.sub!('-r', '-') + return lang + end end end