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:
-rw-r--r--lib/twine/formatters/android.rb13
-rw-r--r--lib/twine/formatters/jquery.rb4
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/twine/formatters/android.rb b/lib/twine/formatters/android.rb
index 55c735c..e8f0642 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
diff --git a/lib/twine/formatters/jquery.rb b/lib/twine/formatters/jquery.rb
index 658b4d2..e6eb495 100644
--- a/lib/twine/formatters/jquery.rb
+++ b/lib/twine/formatters/jquery.rb
@@ -16,9 +16,9 @@ module Twine
def determine_language_given_path(path)
path_arr = path.split(File::SEPARATOR)
path_arr.each do |segment|
- match = /^((.+)-)?([^-]+)\.json$/.match(segment)
+ match = /^(.+)\.json$/.match(segment)
if match
- return match[3]
+ return match[1]
end
end