tr8n 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -1
- data/app/assets/javascripts/tr8n/tr8n-compiled.js +336 -0
- data/app/assets/stylesheets/tr8n/admin.css.scss +23 -0
- data/app/assets/stylesheets/tr8n/components.css.scss +23 -0
- data/app/assets/stylesheets/tr8n/keyboard_1_49.css +271 -0
- data/app/assets/stylesheets/tr8n/layout.css.scss +23 -0
- data/app/assets/stylesheets/tr8n/tr8n.css.scss +1 -1
- data/app/controllers/tr8n/api/v1/base_controller.rb +6 -0
- data/app/controllers/tr8n/api/v1/language_controller.rb +7 -10
- data/app/controllers/tr8n/api/v1/translation_controller.rb +0 -1
- data/app/javascript/compile.rb +37 -0
- data/app/javascript/compile.sh +1 -0
- data/app/javascript/compressors/google/COPYING +202 -0
- data/app/javascript/compressors/google/README +292 -0
- data/app/javascript/compressors/google/compiler.jar +0 -0
- data/app/javascript/config.yml +66 -0
- data/app/javascript/src/base.js +35 -0
- data/app/javascript/src/effects.js +67 -0
- data/app/javascript/src/ext/inflector.js +309 -0
- data/app/{assets/javascripts/tr8n → javascript/src/ext}/jsDraw2D.js +0 -0
- data/app/{assets/javascripts/tr8n → javascript/src/ext}/keyboard_1_36.js +0 -0
- data/app/{assets/javascripts/tr8n → javascript/src/ext}/keyboard_1_44.js +0 -0
- data/app/javascript/src/ext/keyboard_1_49.js +1796 -0
- data/app/javascript/src/ext/md5.js +209 -0
- data/app/{assets/javascripts/tr8n → javascript/src/ext}/shortcut.js +0 -0
- data/app/javascript/src/init.js +47 -0
- data/app/javascript/src/language.js +38 -0
- data/app/javascript/src/logger.js +203 -0
- data/app/{assets/javascripts/tr8n/tr8n_prototype_effects.js → javascript/src/prototype/effects.js} +5 -5
- data/app/javascript/src/proxy.js +254 -0
- data/app/javascript/src/rules/date_rule.js +37 -0
- data/app/javascript/src/rules/gender_list_rule.js +37 -0
- data/app/javascript/src/rules/gender_rule.js +87 -0
- data/app/javascript/src/rules/language_rule.js +55 -0
- data/app/javascript/src/rules/list_rule.js +37 -0
- data/app/javascript/src/rules/numeric_rule.js +95 -0
- data/app/javascript/src/tml/label.js +60 -0
- data/app/javascript/src/tml/token.js +107 -0
- data/app/javascript/src/tokens/data_token.js +45 -0
- data/app/javascript/src/tokens/decoration_token.js +82 -0
- data/app/javascript/src/tokens/token.js +121 -0
- data/app/javascript/src/tokens/transform_token.js +106 -0
- data/app/javascript/src/translation_key.js +183 -0
- data/app/javascript/src/ui/language_case_manager.js +155 -0
- data/app/javascript/src/ui/language_selector.js +126 -0
- data/app/javascript/src/ui/lightbox.js +72 -0
- data/app/javascript/src/ui/translator.js +257 -0
- data/app/javascript/src/utils.js +286 -0
- data/app/models/tr8n/language_case.rb +27 -16
- data/app/models/tr8n/language_case_rule.rb +24 -7
- data/app/models/tr8n/translation_key.rb +23 -21
- data/app/views/tr8n/common/_scripts.html.erb +8 -10
- data/app/views/tr8n/language_cases/_manager_header.html.erb +3 -3
- data/app/views/tr8n/language_cases/manager.html.erb +2 -2
- data/app/views/tr8n/translations/_original_phrase.html.erb +1 -1
- data/lib/tr8n/extensions/action_view_extension.rb +8 -1
- data/lib/tr8n/keyboard_mapping.rb +101 -0
- data/lib/tr8n/token.rb +1 -2
- data/lib/tr8n/version.rb +1 -1
- data/spec/models/tr8n/gender_rule_spec.rb +6 -6
- data/spec/models/tr8n/language_case_rule_spec.rb +219 -1
- data/spec/models/tr8n/language_case_spec.rb +51 -1
- data/spec/models/tr8n/translation_key_spec.rb +256 -0
- data/tr8n.gemspec +2 -1
- metadata +129 -47
- data/app/assets/javascripts/tr8n/tr8n.js +0 -905
- data/app/assets/javascripts/tr8n/tr8n_client_sdk.js +0 -1472
@@ -32,14 +32,32 @@ class Tr8n::LanguageCase < ActiveRecord::Base
|
|
32
32
|
|
33
33
|
serialize :definition
|
34
34
|
|
35
|
+
def self.cache_key(locale, keyword)
|
36
|
+
"language_case_#{locale}_#{keyword}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def cache_key
|
40
|
+
self.class.cache_key(language.locale, keyword)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.by_keyword(keyword, language = Tr8n::Config.current_language)
|
44
|
+
Tr8n::Cache.fetch(cache_key(language.locale, keyword)) do
|
45
|
+
where(:language_id => language.id, :keyword => keyword).first
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
35
49
|
def self.by_id(case_id)
|
36
50
|
Tr8n::Cache.fetch("language_case_#{case_id}") do
|
37
51
|
find_by_id(case_id)
|
38
52
|
end
|
39
53
|
end
|
40
|
-
|
41
|
-
def
|
42
|
-
|
54
|
+
|
55
|
+
def add_rule(definition, opts = {})
|
56
|
+
opts[:position] ||= language_case_rules.count
|
57
|
+
opts[:translator] ||= Tr8n::Config.current_translator
|
58
|
+
Tr8n::LanguageCaseRule.create(:language_case => self, :language => language,
|
59
|
+
:translator => opts[:translator], :position => opts[:position],
|
60
|
+
:definition => definition)
|
43
61
|
end
|
44
62
|
|
45
63
|
def rules
|
@@ -70,7 +88,10 @@ class Tr8n::LanguageCase < ActiveRecord::Base
|
|
70
88
|
destroy
|
71
89
|
end
|
72
90
|
|
73
|
-
def apply(object, value, options)
|
91
|
+
def apply(object, value, options = {})
|
92
|
+
value = value.to_s
|
93
|
+
# pp value
|
94
|
+
|
74
95
|
html_tag_expression = /<\/?[^>]*>/
|
75
96
|
html_tokens = value.scan(html_tag_expression).uniq
|
76
97
|
sanitized_value = value.gsub(html_tag_expression, "")
|
@@ -86,18 +107,15 @@ class Tr8n::LanguageCase < ActiveRecord::Base
|
|
86
107
|
value = value.gsub(html_token, "{$#{index}}")
|
87
108
|
end
|
88
109
|
|
89
|
-
#
|
110
|
+
# pp words
|
90
111
|
words.each do |word|
|
91
112
|
lcvm = Tr8n::LanguageCaseValueMap.by_language_and_keyword(language, word)
|
92
113
|
|
93
114
|
if lcvm
|
94
|
-
# first see if there is an exception for the value
|
95
115
|
map_case_value = lcvm.value_for(object, keyword)
|
96
116
|
case_value = map_case_value unless map_case_value.blank?
|
97
117
|
else
|
98
|
-
|
99
|
-
case_rule = evaluate_rules(object, word)
|
100
|
-
# pp case_rule, word
|
118
|
+
case_rule = rules.detect{|rule| rule.evaluate(object, word)}
|
101
119
|
case_value = case_rule.apply(word) if case_rule
|
102
120
|
end
|
103
121
|
|
@@ -112,13 +130,6 @@ class Tr8n::LanguageCase < ActiveRecord::Base
|
|
112
130
|
value
|
113
131
|
end
|
114
132
|
|
115
|
-
def evaluate_rules(object, value)
|
116
|
-
rules.each do |rule|
|
117
|
-
return rule if rule.evaluate(object, value)
|
118
|
-
end
|
119
|
-
nil
|
120
|
-
end
|
121
|
-
|
122
133
|
def decorate_language_case(case_map_key, case_value, case_rule, options = {})
|
123
134
|
return case_value if options[:skip_decorations]
|
124
135
|
return case_value if language.default?
|
@@ -29,13 +29,26 @@ class Tr8n::LanguageCaseRule < ActiveRecord::Base
|
|
29
29
|
belongs_to :translator, :class_name => "Tr8n::Translator"
|
30
30
|
|
31
31
|
serialize :definition
|
32
|
-
|
32
|
+
|
33
|
+
def definition
|
34
|
+
@indifferent_def ||= HashWithIndifferentAccess.new(super)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.cache_key(id)
|
38
|
+
"language_case_rule_#{id}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def cache_key
|
42
|
+
self.class.cache_key(id)
|
43
|
+
end
|
44
|
+
|
45
|
+
# TODO: what is this for?
|
33
46
|
def self.by_id(id)
|
34
|
-
Tr8n::Cache.fetch(
|
47
|
+
Tr8n::Cache.fetch(cache_key(id)) do
|
35
48
|
find_by_id(id)
|
36
49
|
end
|
37
50
|
end
|
38
|
-
|
51
|
+
|
39
52
|
def self.gender_options
|
40
53
|
[["not applicable", "none"], ["unknown", "unknown"], ["male", "male"], ["female", "female"]]
|
41
54
|
end
|
@@ -60,7 +73,9 @@ class Tr8n::LanguageCaseRule < ActiveRecord::Base
|
|
60
73
|
end
|
61
74
|
|
62
75
|
def evaluate(object, value)
|
63
|
-
|
76
|
+
value = value.to_s
|
77
|
+
|
78
|
+
if ["male", "female", "unknown", "neutral"].include?(definition["gender"])
|
64
79
|
object_gender = Tr8n::GenderRule.gender_token_value(object)
|
65
80
|
return false if definition["gender"] == "male" and object_gender != Tr8n::GenderRule.gender_object_value_for("male")
|
66
81
|
return false if definition["gender"] == "female" and object_gender != Tr8n::GenderRule.gender_object_value_for("female")
|
@@ -74,12 +89,12 @@ class Tr8n::LanguageCaseRule < ActiveRecord::Base
|
|
74
89
|
return false if definition["operator"] == "or" and !(result1 or result2)
|
75
90
|
end
|
76
91
|
|
77
|
-
|
92
|
+
result1
|
78
93
|
end
|
79
94
|
|
80
95
|
def evaluate_part(token_value, index)
|
81
96
|
values = sanitize_values(definition["value#{index}"])
|
82
|
-
|
97
|
+
|
83
98
|
case definition["part#{index}"]
|
84
99
|
when "starts_with"
|
85
100
|
values.each do |value|
|
@@ -111,6 +126,8 @@ class Tr8n::LanguageCaseRule < ActiveRecord::Base
|
|
111
126
|
end
|
112
127
|
|
113
128
|
def apply(value)
|
129
|
+
value = value.to_s
|
130
|
+
|
114
131
|
values = sanitize_values(definition["value1"])
|
115
132
|
regex = values.join('|')
|
116
133
|
case definition["operation"]
|
@@ -156,7 +173,7 @@ class Tr8n::LanguageCaseRule < ActiveRecord::Base
|
|
156
173
|
desc << " token value"
|
157
174
|
desc << describe_part(1)
|
158
175
|
|
159
|
-
if definition["multipart"]
|
176
|
+
if ["true", true].include?(definition["multipart"])
|
160
177
|
desc << " " << definition["operator"]
|
161
178
|
desc << describe_part(2)
|
162
179
|
end
|
@@ -57,7 +57,7 @@ class Tr8n::TranslationKey < ActiveRecord::Base
|
|
57
57
|
existing_key = where(:key => key).first
|
58
58
|
|
59
59
|
unless existing_key
|
60
|
-
if options[:api] and (not Tr8n::Config.api[:allow_key_registration])
|
60
|
+
if options[:api]==:translate and (not Tr8n::Config.api[:allow_key_registration])
|
61
61
|
raise Tr8n::KeyRegistrationException.new("Key registration through API is disabled!")
|
62
62
|
end
|
63
63
|
end
|
@@ -92,7 +92,7 @@ class Tr8n::TranslationKey < ActiveRecord::Base
|
|
92
92
|
end
|
93
93
|
|
94
94
|
# for backwards compatibility only - new keys will be marked as such
|
95
|
-
def self.mark_as_admin(tkey, options)
|
95
|
+
def self.mark_as_admin(tkey, options = {})
|
96
96
|
return if options[:skip_block_options]
|
97
97
|
return unless Tr8n::Config.block_options[:admin]
|
98
98
|
return if tkey.admin?
|
@@ -100,7 +100,7 @@ class Tr8n::TranslationKey < ActiveRecord::Base
|
|
100
100
|
end
|
101
101
|
|
102
102
|
# for backwards compatibility only - if locale is provided update it in the key
|
103
|
-
def self.update_default_locale(tkey, options)
|
103
|
+
def self.update_default_locale(tkey, options = {})
|
104
104
|
return if options[:skip_block_options]
|
105
105
|
return unless tkey.locale.blank?
|
106
106
|
key_locale = Tr8n::Config.block_options[:default_locale] || Tr8n::Config.default_locale
|
@@ -109,34 +109,36 @@ class Tr8n::TranslationKey < ActiveRecord::Base
|
|
109
109
|
|
110
110
|
# creates associations between the translation keys and sources
|
111
111
|
# used for the site map and javascript support
|
112
|
-
def self.track_source(translation_key, options)
|
112
|
+
def self.track_source(translation_key, options = {})
|
113
113
|
|
114
|
-
# key source tracking or
|
115
|
-
|
114
|
+
# key source tracking must be enabled or request must come from an API (JavaScript) to get it registered with a source
|
115
|
+
if Tr8n::Config.enable_key_source_tracking? or options[:api] == :translate
|
116
116
|
|
117
|
-
|
118
|
-
|
117
|
+
# source can be passed into an individual key, or as a block or fall back on the controller/action
|
118
|
+
source = options[:source] || Tr8n::Config.block_options[:source] || Tr8n::Config.current_source
|
119
119
|
|
120
|
-
|
121
|
-
|
120
|
+
# should never be blank
|
121
|
+
return if source.blank?
|
122
122
|
|
123
|
-
|
124
|
-
|
123
|
+
# each page or component is identified by a translation source
|
124
|
+
translation_source = Tr8n::TranslationSource.find_or_create(source, options[:url])
|
125
125
|
|
126
|
-
|
127
|
-
|
126
|
+
# each key is associated with one or more sources
|
127
|
+
translation_key_source = Tr8n::TranslationKeySource.find_or_create(translation_key, translation_source)
|
128
|
+
|
129
|
+
end
|
128
130
|
|
129
131
|
# for debugging purposes only - this will track the actual location of the key in the source
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
if Tr8n::Config.enable_key_caller_tracking?
|
133
|
+
options[:caller] ||= caller
|
134
|
+
options[:caller_key] = options[:caller].is_a?(Array) ? options[:caller].join(", ") : options[:caller].to_s
|
135
|
+
options[:caller_key] = generate_key(options[:caller_key])
|
136
|
+
translation_key_source.update_details!(options)
|
137
|
+
end
|
138
|
+
|
135
139
|
end
|
136
140
|
|
137
141
|
def self.generate_key(label, desc = "")
|
138
|
-
# TODO: there is something iffy going on with the strings from the hash
|
139
|
-
# without the extra ~ = the strings are not seen in the sqlite database - wtf?
|
140
142
|
"#{Digest::MD5.hexdigest("#{label};;;#{desc}")}~"[0..-2]
|
141
143
|
end
|
142
144
|
|
@@ -2,8 +2,15 @@
|
|
2
2
|
|
3
3
|
<%= tr8n_splash_screen_tag %>
|
4
4
|
|
5
|
+
<% if Tr8n::Config.enable_software_keyboard? %>
|
6
|
+
<script>
|
7
|
+
VKI_default_layout = "<%=Tr8n::KeyboardMapping.current_1_49%>";
|
8
|
+
</script>
|
9
|
+
<%=stylesheet_link_tag("tr8n/keyboard_1_49.css") -%>
|
10
|
+
<% end %>
|
11
|
+
|
5
12
|
<%=stylesheet_link_tag("tr8n/tr8n.css") -%>
|
6
|
-
<%=javascript_include_tag("tr8n/tr8n.js") -%>
|
13
|
+
<%=javascript_include_tag("tr8n/tr8n-compiled.js", :charset => "UTF-8") -%>
|
7
14
|
|
8
15
|
<script type="text/javascript">
|
9
16
|
initializeTr8n();
|
@@ -24,16 +31,7 @@
|
|
24
31
|
</script>
|
25
32
|
<% end %>
|
26
33
|
|
27
|
-
<% if Tr8n::Config.enable_software_keyboard? %>
|
28
|
-
<script>
|
29
|
-
VKI_default_layout = "<%=Tr8n::KeyboardMapping.current_1_36%>";
|
30
|
-
</script>
|
31
|
-
<%=javascript_include_tag("tr8n/keyboard_1_36.js", :charset => "UTF-8") -%>
|
32
|
-
<%=stylesheet_link_tag("tr8n/keyboard_1_36.css") -%>
|
33
|
-
<% end %>
|
34
|
-
|
35
34
|
<% if Tr8n::Config.enable_keyboard_shortcuts? %>
|
36
|
-
<%=javascript_include_tag("tr8n/shortcut.js", :charset => "UTF-8") -%>
|
37
35
|
<script type="text/javascript">
|
38
36
|
<% Tr8n::Config.default_shortcuts.each do |key, data| %>
|
39
37
|
shortcut.add("<%=key%>", function() {
|
@@ -1,16 +1,16 @@
|
|
1
1
|
<div class="original_text">
|
2
2
|
<div class="supplemental">
|
3
3
|
<% if @map.id %>
|
4
|
-
<%=link_to_function(image_tag("
|
4
|
+
<%=link_to_function(image_tag("tr8n/exclamation.png", :title=>trla("Report these language case values")), "tr8nLanguageCaseManager.reportCaseMap('#{@map.id}')")%>
|
5
5
|
<% end %>
|
6
6
|
<%= tr8n_help_icon_tag %>
|
7
7
|
</div>
|
8
8
|
|
9
9
|
<div class="quiet small"><%=trl("Original Word")%></div>
|
10
10
|
<div class="quote">
|
11
|
-
<%=image_tag("
|
11
|
+
<%=image_tag("tr8n/left_quote.png") %>
|
12
12
|
<%=@map.keyword %>
|
13
|
-
<%=image_tag("
|
13
|
+
<%=image_tag("tr8n/right_quote.png") %>
|
14
14
|
</div>
|
15
15
|
</div>
|
16
16
|
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
<% if params[:stem_type] %>
|
4
4
|
<% left_right = params[:stem_type].index("right") ? "right" : "left" %>
|
5
|
-
<%=image_tag("
|
5
|
+
<%=image_tag("tr8n/top_left_stem.png", :class => "stem #{params[:stem_type]}", :style => "#{left_right}:#{params[:stem_offset]}px")%>
|
6
6
|
<% end %>
|
7
7
|
|
8
8
|
<div class="hd">
|
9
9
|
<div class="supplemental">
|
10
|
-
<%=link_to_function(image_tag("
|
10
|
+
<%=link_to_function(image_tag("tr8n/close.gif", :title=>trl("Close")), "tr8nLanguageCaseManager.hide()")%>
|
11
11
|
</div>
|
12
12
|
<%= tr8n_language_flag_tag(tr8n_current_language) %>
|
13
13
|
<%= trla("{language} Language Cases", nil, :language => tr8n_current_language.native_name) %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% color = translation.key.locked? ? "#ECFFEF" : "#FDFDDF" %>
|
2
2
|
<div style="font-size: 11px; color: grey; margin-top:5px; margin-bottom:5px; padding:3px; background:<%=color%>; border:1px dotted #ccc;">
|
3
3
|
<% if translation.key.locked? %>
|
4
|
-
<div style="float:right"><%=image_tag("
|
4
|
+
<div style="float:right"><%=image_tag("tr8n/lock.png", :style=>"width:12px", :title => trla("This phrase is locked"))%></div>
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<%=tra("Original Phrase:", "Translation section header")%> <%=link_to(translation.key.sanitized_label, :controller => "/tr8n/phrases", :action => :view, :locale => translation.language.locale, :translation_key_id => translation.key.id) %>
|
@@ -89,7 +89,8 @@ module Tr8n
|
|
89
89
|
|
90
90
|
client_var_name = opts[:client_var_name] || :tr8nProxy
|
91
91
|
|
92
|
-
html = [
|
92
|
+
html = []
|
93
|
+
# html << [javascript_include_tag("tr8n/tr8n_client_sdk.js")]
|
93
94
|
html << "<script>"
|
94
95
|
html << " var #{client_var_name} = new Tr8n.Proxy(#{opts.to_json});"
|
95
96
|
html << " function reloadTranslations() { "
|
@@ -101,6 +102,12 @@ module Tr8n
|
|
101
102
|
html << " function trl(label, description, tokens, options) { "
|
102
103
|
html << " return #{client_var_name}.trl(label, description, tokens, options); "
|
103
104
|
html << " } "
|
105
|
+
|
106
|
+
# TODO: check if TML is enabled
|
107
|
+
html << " Tr8n.Utils.addEvent(window, 'load', function() { "
|
108
|
+
html << " #{client_var_name}.initTml(); "
|
109
|
+
html << " }) "
|
110
|
+
|
104
111
|
html << "</script>"
|
105
112
|
html.join("\n").html_safe
|
106
113
|
end
|
@@ -172,5 +172,106 @@ module Tr8n
|
|
172
172
|
|
173
173
|
return "US International"
|
174
174
|
end
|
175
|
+
|
176
|
+
def self.current_1_49
|
177
|
+
[
|
178
|
+
{:key => '\u0627\u0644\u0639\u0631\u0628\u064a\u0629', :name => 'Arabic', :locale => ''},
|
179
|
+
{:key => '\u0985\u09b8\u09ae\u09c0\u09df\u09be', :name => 'Assamese', :locale => ''},
|
180
|
+
{:key => '\u0410\u0437\u04d9\u0440\u0431\u0430\u0458\u04b9\u0430\u043d\u04b9\u0430', :name => 'Azerbaijani Cyrillic', :locale => ''},
|
181
|
+
{:key => 'Az\u0259rbaycanca', :name => 'Azerbaijani Latin', :locale => ''},
|
182
|
+
{:key => '\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f', :name => 'Belarusian', :locale => ''},
|
183
|
+
{:key => 'Belgische / Belge', :name => 'Belgian', :locale => ''},
|
184
|
+
{:key => '\u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438 \u0424\u043e\u043d\u0435\u0442\u0438\u0447\u0435\u043d', :name => 'Bulgarian Phonetic', :locale => ''},
|
185
|
+
{:key => '\u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438', :name => 'Bulgarian BDS', :locale => ''},
|
186
|
+
{:key => '\u09ac\u09be\u0982\u09b2\u09be', :name => 'Bengali', :locale => ''},
|
187
|
+
{:key => 'Bosanski', :name => 'Bosnian', :locale => ''},
|
188
|
+
{:key => 'Canadienne-fran\u00e7aise', :name => 'Canadian French', :locale => ''},
|
189
|
+
{:key => '\u010cesky', :name => 'Czech', :locale => ''},
|
190
|
+
{:key => 'Dansk', :name => 'Danish', :locale => ''},
|
191
|
+
{:key => 'Deutsch', :name => 'German', :locale => ''},
|
192
|
+
{:key => 'Dingbats', :name => 'Dingbats', :locale => ''},
|
193
|
+
{:key => '\u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0', :name => 'Divehi', :locale => ''},
|
194
|
+
{:key => 'Dvorak', :name => 'Dvorak', :locale => ''},
|
195
|
+
{:key => '\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac', :name => 'Greek', :locale => ''},
|
196
|
+
{:key => 'Eesti', :name => 'Estonian', :locale => ''},
|
197
|
+
{:key => 'Espa\u00f1ol', :name => 'Spanish', :locale => ''},
|
198
|
+
{:key => '\u062f\u0631\u06cc', :name => 'Dari', :locale => ''},
|
199
|
+
{:key => '\u0641\u0627\u0631\u0633\u06cc', :name => 'Farsi', :locale => ''},
|
200
|
+
{:key => 'F\u00f8royskt', :name => 'Faeroese', :locale => ''},
|
201
|
+
{:key => 'Fran\u00e7ais', :name => 'French', :locale => ''},
|
202
|
+
{:key => 'Gaeilge', :name => 'Irish / Gaelic', :locale => ''},
|
203
|
+
{:key => '\u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0', :name => 'Gujarati', :locale => ''},
|
204
|
+
{:key => '\u05e2\u05d1\u05e8\u05d9\u05ea', :name => 'Hebrew', :locale => ''},
|
205
|
+
{:key => '\u0926\u0947\u0935\u0928\u093e\u0917\u0930\u0940', :name => 'Devanagari', :locale => ''},
|
206
|
+
{:key => '\u0939\u093f\u0902\u0926\u0940', :name => 'Hindi', :locale => ''},
|
207
|
+
{:key => 'Hrvatski', :name => 'Croatian', :locale => ''},
|
208
|
+
{:key => '\u0540\u0561\u0575\u0565\u0580\u0565\u0576 \u0561\u0580\u0565\u0582\u0574\u0578\u0582\u057f\u0584', :name => 'Western Armenian', :locale => ''},
|
209
|
+
{:key => '\u0540\u0561\u0575\u0565\u0580\u0565\u0576 \u0561\u0580\u0565\u0582\u0565\u056c\u0584', :name => 'Eastern Armenian', :locale => ''},
|
210
|
+
{:key => '\u00cdslenska', :name => 'Icelandic', :locale => ''},
|
211
|
+
{:key => 'Italiano', :name => 'Italian', :locale => ''},
|
212
|
+
{:key => '\u65e5\u672c\u8a9e', :name => 'Japanese Hiragana/Katakana', :locale => ''},
|
213
|
+
{:key => '\u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8', :name => 'Georgian', :locale => ''},
|
214
|
+
{:key => '\u049a\u0430\u0437\u0430\u049b\u0448\u0430', :name => 'Kazakh', :locale => ''},
|
215
|
+
{:key => '\u1797\u17b6\u179f\u17b6\u1781\u17d2\u1798\u17c2\u179a', :name => 'Khmer', :locale => ''},
|
216
|
+
{:key => '\u0c95\u0ca8\u0ccd\u0ca8\u0ca1', :name => 'Kannada', :locale => ''},
|
217
|
+
{:key => '\ud55c\uad6d\uc5b4', :name => 'Korean', :locale => ''},
|
218
|
+
{:key => 'Kurd\u00ee', :name => 'Kurdish', :locale => ''},
|
219
|
+
{:key => '\u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430', :name => 'Kyrgyz', :locale => ''},
|
220
|
+
{:key => 'Latvie\u0161u', :name => 'Latvian', :locale => ''},
|
221
|
+
{:key => 'Lietuvi\u0173', :name => 'Lithuanian', :locale => ''},
|
222
|
+
{:key => 'Magyar', :name => 'Hungarian', :locale => ''},
|
223
|
+
{:key => 'Malti', :name => 'Maltese 48', :locale => ''},
|
224
|
+
{:key => '\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438', :name => 'Macedonian Cyrillic', :locale => ''},
|
225
|
+
{:key => '\u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02', :name => 'Malayalam', :locale => ''},
|
226
|
+
{:key => 'Misc. Symbols', :name => 'Misc. Symbols', :locale => ''},
|
227
|
+
{:key => '\u041c\u043e\u043d\u0433\u043e\u043b', :name => 'Mongolian Cyrillic', :locale => ''},
|
228
|
+
{:key => '\u092e\u0930\u093e\u0920\u0940', :name => 'Marathi', :locale => ''},
|
229
|
+
{:key => '\u1019\u103c\u1014\u103a\u1019\u102c\u1018\u102c\u101e\u102c', :name => 'Burmese', :locale => ''},
|
230
|
+
{:key => 'Nederlands', :name => 'Dutch', :locale => ''},
|
231
|
+
{:key => 'Norsk', :name => 'Norwegian', :locale => ''},
|
232
|
+
{:key => '\u067e\u069a\u062a\u0648', :name => 'Pashto', :locale => ''},
|
233
|
+
{:key => '\u0a2a\u0a70\u0a1c\u0a3e\u0a2c\u0a40', :name => 'Punjabi (Gurmukhi)', :locale => ''},
|
234
|
+
{:key => '\u62fc\u97f3 (Pinyin)', :name => 'Pinyin', :locale => ''},
|
235
|
+
{:key => 'Polski', :name => 'Polish (214)', :locale => ''},
|
236
|
+
{:key => 'Polski Programisty', :name => 'Polish Programmers', :locale => ''},
|
237
|
+
{:key => 'Portugu\u00eas Brasileiro', :name => 'Portuguese (Brazil)', :locale => ''},
|
238
|
+
{:key => 'Portugu\u00eas', :name => 'Portuguese', :locale => ''},
|
239
|
+
{:key => 'Rom\u00e2n\u0103', :name => 'Romanian', :locale => ''},
|
240
|
+
{:key => '\u0420\u0443\u0441\u0441\u043a\u0438\u0439', :name => 'Russian', :locale => ''},
|
241
|
+
{:key => 'Schweizerdeutsch', :name => 'Swiss German', :locale => ''},
|
242
|
+
{:key => 'Shqip', :name => 'Albanian', :locale => ''},
|
243
|
+
{:key => 'Sloven\u010dina', :name => 'Slovak', :locale => ''},
|
244
|
+
{:key => 'Sloven\u0161\u010dina', :name => 'Slovenian', :locale => ''},
|
245
|
+
{:key => '\u0441\u0440\u043f\u0441\u043a\u0438', :name => 'Serbian Cyrillic', :locale => ''},
|
246
|
+
{:key => 'Srpski', :name => 'Serbian Latin', :locale => ''},
|
247
|
+
{:key => 'Suomi', :name => 'Finnish', :locale => ''},
|
248
|
+
{:key => 'Svenska', :name => 'Swedish', :locale => ''},
|
249
|
+
{:key => 'Swiss Fran\u00e7ais', :name => 'Swiss French', :locale => ''},
|
250
|
+
{:key => '\u0723\u0718\u072a\u071d\u071d\u0710', :name => 'Syriac', :locale => ''},
|
251
|
+
{:key => '\u0ba4\u0bae\u0bbf\u0bb4\u0bcd', :name => 'Tamil', :locale => ''},
|
252
|
+
{:key => '\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41', :name => 'Telugu', :locale => ''},
|
253
|
+
{:key => 'Ti\u1ebfng Vi\u1ec7t', :name => 'Vietnamese', :locale => ''},
|
254
|
+
{:key => '\u0e44\u0e17\u0e22 Kedmanee', :name => 'Thai Kedmane', :locale => ''},
|
255
|
+
{:key => '\u0e44\u0e17\u0e22 Pattachote', :name => 'Thai Pattachote', :locale => ''},
|
256
|
+
{:key => '\u0422\u0430\u0442\u0430\u0440\u0447\u0430', :name => 'Tatar', :locale => ''},
|
257
|
+
{:key => 'T\u00fcrk\u00e7e F', :name => 'Turkish F', :locale => ''},
|
258
|
+
{:key => 'T\u00fcrk\u00e7e Q', :name => 'Turkish Q', :locale => ''},
|
259
|
+
{:key => '\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430', :name => 'Ukrainian', :locale => ''},
|
260
|
+
{:key => 'United Kingdom', :name => 'United Kingdom', :locale => ''},
|
261
|
+
{:key => '\u0627\u0631\u062f\u0648', :name => 'Urdu', :locale => ''},
|
262
|
+
{:key => '\u0627\u0631\u062f\u0648 Phonetic', :name => 'Urdu Phonetic', :locale => ''},
|
263
|
+
{:key => 'US Standard', :name => 'US Standard', :locale => ''},
|
264
|
+
{:key => 'US International', :name => 'US International', :locale => ''},
|
265
|
+
{:key => '\u040e\u0437\u0431\u0435\u043a\u0447\u0430', :name => 'Uzbek Cyrillic', :locale => ''},
|
266
|
+
{:key => '\u05d9\u05d9\u05b4\u05d3\u05d9\u05e9', :name => 'Yiddish', :locale => ''},
|
267
|
+
{:key => '\u05d9\u05d9\u05b4\u05d3\u05d9\u05e9 \u05dc\u05e2\u05d1\u05d8', :name => 'Yiddish (Yidish Lebt)', :locale => ''},
|
268
|
+
{:key => '\u4e2d\u6587\u6ce8\u97f3\u7b26\u53f7', :name => 'Chinese Bopomofo IME', :locale => ''},
|
269
|
+
{:key => '\u4e2d\u6587\u4ed3\u9889\u8f93\u5165\u6cd5', :name => 'Chinese Cangjie IME', :locale => ''}
|
270
|
+
].each do |kb|
|
271
|
+
return kb[:key] if kb[:name].index(Tr8n::Config.current_language.english_name.split(" ").first)
|
272
|
+
end
|
273
|
+
|
274
|
+
return "US International"
|
275
|
+
end
|
175
276
|
end
|
176
277
|
end
|
data/lib/tr8n/token.rb
CHANGED
@@ -201,7 +201,7 @@ module Tr8n
|
|
201
201
|
value = ERB::Util.html_escape(value)
|
202
202
|
end
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
if has_case_key?
|
206
206
|
value = apply_case(object, value, options, language)
|
207
207
|
end
|
@@ -402,7 +402,6 @@ module Tr8n
|
|
402
402
|
end
|
403
403
|
|
404
404
|
def substitute(label, values = {}, options = {}, language = Tr8n::Config.current_language)
|
405
|
-
|
406
405
|
# get the object from the values
|
407
406
|
object = values[name_key]
|
408
407
|
|