tr8n 3.1.8 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.rspec +1 -0
- data/.rvmrc +1 -1
- data/.watchr +18 -0
- data/Gemfile.lock +16 -10
- data/app/assets/images/tr8n/minus_node.png +0 -0
- data/app/assets/images/tr8n/pixel.gif +0 -0
- data/app/assets/images/tr8n/plus_node.png +0 -0
- data/app/assets/javascripts/tr8n/tr8n.js +1 -0
- data/app/assets/javascripts/tr8n/tr8n_client_sdk.js +581 -425
- data/app/assets/stylesheets/tr8n/layout.css.scss +1 -1
- data/app/assets/stylesheets/tr8n/tr8n.css.scss +20 -0
- data/app/controllers/tr8n/admin/base_controller.rb +4 -1
- data/app/controllers/tr8n/admin/clientsdk_controller.rb +1 -1
- data/app/controllers/tr8n/admin/metrics_controller.rb +30 -0
- data/app/controllers/tr8n/api/v1/base_controller.rb +12 -0
- data/app/controllers/tr8n/api/v1/language_controller.rb +7 -5
- data/app/controllers/tr8n/awards_controller.rb +1 -1
- data/app/controllers/tr8n/base_controller.rb +12 -6
- data/app/controllers/tr8n/dashboard_controller.rb +1 -1
- data/app/controllers/tr8n/forum_controller.rb +1 -1
- data/app/controllers/tr8n/glossary_controller.rb +1 -1
- data/app/controllers/tr8n/help_controller.rb +1 -1
- data/app/controllers/tr8n/phrases_controller.rb +1 -1
- data/app/controllers/tr8n/translator_controller.rb +8 -0
- data/app/helpers/tr8n/admin/base_helper.rb +1 -1
- data/app/helpers/tr8n/base_helper.rb +1 -1
- data/app/helpers/tr8n/dashboard_helper.rb +1 -1
- data/app/models/tr8n/base_filter.rb +1 -1
- data/app/models/tr8n/daily_language_metric.rb +1 -1
- data/app/models/tr8n/date_rule.rb +1 -1
- data/app/models/tr8n/gender_list_rule.rb +1 -1
- data/app/models/tr8n/gender_rule.rb +1 -1
- data/app/models/tr8n/glossary.rb +1 -1
- data/app/models/tr8n/glossary_filter.rb +1 -1
- data/app/models/tr8n/integration/ru/russian_gender_list_rule.rb +1 -1
- data/app/models/tr8n/integration/ru/russian_numeric_rule.rb +1 -1
- data/app/models/tr8n/ip_location.rb +1 -1
- data/app/models/tr8n/ip_location_filter.rb +1 -1
- data/app/models/tr8n/language.rb +19 -7
- data/app/models/tr8n/language_case.rb +1 -1
- data/app/models/tr8n/language_case_filter.rb +1 -1
- data/app/models/tr8n/language_case_rule.rb +1 -1
- data/app/models/tr8n/language_case_rule_filter.rb +1 -1
- data/app/models/tr8n/language_case_value_map.rb +1 -1
- data/app/models/tr8n/language_case_value_map_filter.rb +1 -1
- data/app/models/tr8n/language_filter.rb +1 -1
- data/app/models/tr8n/language_forum_abuse_report.rb +1 -1
- data/app/models/tr8n/language_forum_abuse_report_filter.rb +1 -1
- data/app/models/tr8n/language_forum_message.rb +1 -1
- data/app/models/tr8n/language_forum_message_filter.rb +1 -1
- data/app/models/tr8n/language_forum_topic.rb +1 -1
- data/app/models/tr8n/language_forum_topic_filter.rb +1 -1
- data/app/models/tr8n/language_metric.rb +1 -1
- data/app/models/tr8n/language_metric_filter.rb +1 -1
- data/app/models/tr8n/language_rule.rb +1 -1
- data/app/models/tr8n/language_rule_filter.rb +1 -1
- data/app/models/tr8n/language_user.rb +1 -1
- data/app/models/tr8n/language_user_filter.rb +1 -1
- data/app/models/tr8n/list_rule.rb +1 -1
- data/app/models/tr8n/monthly_language_metric.rb +1 -1
- data/app/models/tr8n/numeric_rule.rb +35 -28
- data/app/models/tr8n/sync_log.rb +1 -1
- data/app/models/tr8n/sync_log_filter.rb +1 -1
- data/app/models/tr8n/total_language_metric.rb +1 -1
- data/app/models/tr8n/translation.rb +4 -3
- data/app/models/tr8n/translation_domain.rb +11 -3
- data/app/models/tr8n/translation_domain_filter.rb +1 -1
- data/app/models/tr8n/translation_filter.rb +1 -1
- data/app/models/tr8n/translation_key.rb +73 -36
- data/app/models/tr8n/translation_key_comment.rb +1 -1
- data/app/models/tr8n/translation_key_comment_filter.rb +1 -1
- data/app/models/tr8n/translation_key_filter.rb +1 -1
- data/app/models/tr8n/translation_key_lock.rb +1 -1
- data/app/models/tr8n/translation_key_lock_filter.rb +1 -1
- data/app/models/tr8n/translation_key_source.rb +16 -5
- data/app/models/tr8n/translation_key_source_filter.rb +1 -1
- data/app/models/tr8n/translation_source.rb +12 -4
- data/app/models/tr8n/translation_source_filter.rb +1 -1
- data/app/models/tr8n/translation_source_language.rb +1 -1
- data/app/models/tr8n/translation_vote.rb +1 -1
- data/app/models/tr8n/translation_vote_filter.rb +1 -1
- data/app/models/tr8n/translator.rb +21 -5
- data/app/models/tr8n/translator_filter.rb +1 -1
- data/app/models/tr8n/translator_following.rb +1 -1
- data/app/models/tr8n/translator_following_filter.rb +1 -1
- data/app/models/tr8n/translator_log.rb +3 -3
- data/app/models/tr8n/translator_log_filter.rb +1 -1
- data/app/models/tr8n/translator_metric.rb +1 -1
- data/app/models/tr8n/translator_metric_filter.rb +1 -1
- data/app/models/tr8n/translator_report.rb +1 -1
- data/app/models/tr8n/translator_report_filter.rb +1 -1
- data/app/models/tr8n/value_rule.rb +1 -1
- data/app/views/tr8n/admin/clientsdk/index.html.erb +29 -29
- data/app/views/tr8n/admin/clientsdk/lb_samples.html.erb +1 -1
- data/app/views/tr8n/admin/metrics/_tabs.html.erb +22 -0
- data/app/views/tr8n/admin/metrics/index.html.erb +60 -0
- data/app/views/tr8n/common/_header.html.erb +3 -1
- data/app/views/tr8n/common/_language_selector.html.erb +4 -2
- data/app/views/tr8n/common/_scripts.html.erb +5 -0
- data/app/views/tr8n/common/_terms_of_service.html.erb +53 -0
- data/app/views/tr8n/help/credits.html.erb +4 -0
- data/app/views/tr8n/language/_select.html.erb +5 -1
- data/app/views/tr8n/translator/registration.html.erb +21 -0
- data/config/routes.rb +3 -1
- data/doc/classes.graffle +356 -7194
- data/lib/generators/tr8n/templates/config/tr8n/config.yml +9 -1
- data/lib/generators/tr8n/templates/config/tr8n/site/shortcuts.yml +1 -1
- data/lib/generators/tr8n/templates/config/tr8n/tokens/decorations.yml +4 -1
- data/lib/generators/tr8n/tr8n_generator.rb +1 -1
- data/lib/tasks/tr8n.rake +1 -1
- data/lib/tr8n.rb +23 -0
- data/lib/tr8n/active_dumper.rb +1 -1
- data/lib/tr8n/cache.rb +1 -8
- data/lib/tr8n/cache_adapters/memcached.rb +1 -1
- data/lib/tr8n/config.rb +37 -1
- data/lib/tr8n/dictionary.rb +1 -1
- data/lib/tr8n/engine.rb +4 -1
- data/lib/tr8n/exception.rb +1 -1
- data/lib/tr8n/extender.rb +1 -1
- data/lib/tr8n/extensions/action_controller_extension.rb +5 -4
- data/lib/tr8n/extensions/action_view_extension.rb +71 -20
- data/lib/tr8n/extensions/array_extension.rb +14 -1
- data/lib/tr8n/extensions/date_extension.rb +1 -1
- data/lib/tr8n/extensions/fixnum_extension.rb +1 -1
- data/lib/tr8n/extensions/hash_extension.rb +1 -1
- data/lib/tr8n/extensions/string_extension.rb +1 -1
- data/lib/tr8n/extensions/time_extension.rb +1 -1
- data/lib/tr8n/ip_address.rb +1 -1
- data/lib/tr8n/key_registration_exception.rb +1 -1
- data/lib/tr8n/keyboard_mapping.rb +1 -1
- data/lib/tr8n/logger.rb +1 -1
- data/lib/tr8n/railtie.rb +1 -1
- data/lib/tr8n/site_map.rb +1 -1
- data/lib/tr8n/site_map_section.rb +1 -1
- data/lib/tr8n/token.rb +1 -1
- data/lib/tr8n/token_exception.rb +1 -1
- data/lib/tr8n/tokenized_label.rb +2 -12
- data/lib/tr8n/tokens/data_token.rb +1 -1
- data/lib/tr8n/tokens/decoration_token.rb +1 -1
- data/lib/tr8n/tokens/hidden_token.rb +1 -1
- data/lib/tr8n/tokens/method_token.rb +1 -1
- data/lib/tr8n/tokens/transform_token.rb +1 -1
- data/lib/tr8n/version.rb +25 -1
- data/local/tr8n_server/app/models/user.rb +1 -0
- data/local/tr8n_server/config/environments/test.rb +1 -1
- data/local/tr8n_server/config/tr8n/config.yml +45 -39
- data/local/tr8n_server/config/tr8n/site/shortcuts.yml +1 -1
- data/local/tr8n_server/db/schema.rb +2 -0
- data/spec/controllers/awards_controller_spec.rb +22 -0
- data/spec/controllers/base_controller_spec.rb +6 -0
- data/spec/controllers/dashboard_controller_spec.rb +23 -0
- data/spec/controllers/forum_controller_spec.rb +23 -0
- data/spec/controllers/glossary_controller_spec.rb +22 -0
- data/spec/controllers/help_controller_spec.rb +22 -0
- data/spec/controllers/language_cases_controller_spec.rb +13 -0
- data/spec/controllers/language_controller_spec.rb +10 -0
- data/spec/controllers/phrases_controller_spec.rb +22 -0
- data/spec/controllers/translations_controller_spec.rb +23 -0
- data/spec/controllers/translator_controller_spec.rb +22 -0
- data/spec/lib/tokenized_label_spec.rb +42 -0
- data/spec/lib/tokens/data_token_spec.rb +49 -0
- data/spec/lib/tokens/decoration_token_spec.rb +49 -0
- data/spec/lib/tokens/hidden_token_spec.rb +53 -0
- data/spec/lib/tokens/method_token_spec.rb +61 -0
- data/spec/lib/tokens/transform_token_spec.rb +51 -0
- data/spec/models/tr8n/daily_language_metric_spec.rb +5 -0
- data/spec/models/tr8n/date_rule_spec.rb +5 -0
- data/spec/models/tr8n/gender_list_rule_spec.rb +5 -0
- data/spec/models/tr8n/gender_rule_spec.rb +141 -0
- data/spec/models/tr8n/glossary_spec.rb +5 -0
- data/spec/models/tr8n/ip_location_spec.rb +5 -0
- data/spec/models/tr8n/language_case_rule_spec.rb +5 -0
- data/spec/models/tr8n/language_case_spec.rb +5 -0
- data/spec/models/tr8n/language_case_value_map_spec.rb +5 -0
- data/spec/models/tr8n/language_forum_abuse_report_spec.rb +5 -0
- data/spec/models/tr8n/language_forum_message_spec.rb +5 -0
- data/spec/models/tr8n/language_forum_topic_spec.rb +5 -0
- data/spec/models/tr8n/language_metric_spec.rb +5 -0
- data/spec/models/tr8n/language_rule_spec.rb +5 -0
- data/spec/models/tr8n/language_spec.rb +79 -0
- data/spec/models/tr8n/language_user_spec.rb +5 -0
- data/spec/models/tr8n/list_rule_spec.rb +5 -0
- data/spec/models/tr8n/monthly_language_metric_spec.rb +5 -0
- data/spec/models/tr8n/numeric_rule_spec.rb +162 -0
- data/spec/models/tr8n/sync_log_spec.rb +5 -0
- data/spec/models/tr8n/total_language_metric_spec.rb +5 -0
- data/spec/models/tr8n/translation_domain_spec.rb +5 -0
- data/spec/models/tr8n/translation_key_comment_spec.rb +5 -0
- data/spec/models/tr8n/translation_key_lock_spec.rb +5 -0
- data/spec/models/tr8n/translation_key_source_spec.rb +5 -0
- data/spec/models/tr8n/translation_key_spec.rb +118 -0
- data/spec/models/tr8n/translation_source_language_spec.rb +5 -0
- data/spec/models/tr8n/translation_source_spec.rb +5 -0
- data/spec/models/tr8n/translation_spec.rb +5 -0
- data/spec/models/tr8n/translation_vote_spec.rb +5 -0
- data/spec/models/tr8n/translator_following_spec.rb +5 -0
- data/spec/models/tr8n/translator_log_spec.rb +5 -0
- data/spec/models/tr8n/translator_metric_spec.rb +5 -0
- data/spec/models/tr8n/translator_report_spec.rb +5 -0
- data/spec/models/tr8n/translator_spec.rb +140 -0
- data/spec/spec_helper.rb +26 -27
- data/tr8n.gemspec +3 -1
- metadata +173 -50
- data/local/tr8n_server/db/migrate/20110930041150_create_tr8n_tables.rb +0 -372
- data/spec/fake_app.rb +0 -50
- data/spec/lib/data_token_spec.rb +0 -26
- data/spec/lib/transform_token_spec.rb +0 -22
- data/spec/models/translation_key_spec.rb +0 -63
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-
|
2
|
+
# Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#++
|
23
23
|
|
24
24
|
class Tr8n::TranslationKeySource < ActiveRecord::Base
|
25
|
-
set_table_name
|
25
|
+
set_table_name :tr8n_translation_key_sources
|
26
26
|
after_destroy :clear_cache
|
27
27
|
|
28
28
|
belongs_to :translation_source, :class_name => "Tr8n::TranslationSource"
|
@@ -33,10 +33,21 @@ class Tr8n::TranslationKeySource < ActiveRecord::Base
|
|
33
33
|
|
34
34
|
serialize :details
|
35
35
|
|
36
|
+
def self.cache_key(translation_key_id, translation_source_id)
|
37
|
+
"translation_key_source_#{translation_key_id}_#{translation_source_id}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def cache_key
|
41
|
+
self.class.cache_key(translation_key_id, translation_source_id)
|
42
|
+
end
|
43
|
+
|
36
44
|
def self.find_or_create(translation_key, translation_source)
|
37
|
-
Tr8n::Cache.fetch(
|
45
|
+
Tr8n::Cache.fetch(cache_key(translation_key.id, translation_source.id)) do
|
38
46
|
tks = where("translation_key_id = ? and translation_source_id = ?", translation_key.id, translation_source.id).first
|
39
|
-
tks
|
47
|
+
tks ||= begin
|
48
|
+
translation_source.touch
|
49
|
+
create(:translation_key => translation_key, :translation_source => translation_source)
|
50
|
+
end
|
40
51
|
end
|
41
52
|
end
|
42
53
|
|
@@ -51,7 +62,7 @@ class Tr8n::TranslationKeySource < ActiveRecord::Base
|
|
51
62
|
end
|
52
63
|
|
53
64
|
def clear_cache
|
54
|
-
Tr8n::Cache.delete(
|
65
|
+
Tr8n::Cache.delete(cache_key)
|
55
66
|
end
|
56
67
|
|
57
68
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-
|
2
|
+
# Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -35,9 +35,17 @@ class Tr8n::TranslationSource < ActiveRecord::Base
|
|
35
35
|
alias :sources :translation_key_sources
|
36
36
|
alias :keys :translation_keys
|
37
37
|
|
38
|
+
def self.cache_key(source)
|
39
|
+
"translation_source_#{source}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def cache_key
|
43
|
+
self.class.cache_key(source)
|
44
|
+
end
|
45
|
+
|
38
46
|
def self.find_or_create(source, url = nil)
|
39
|
-
|
40
|
-
|
47
|
+
Tr8n::Cache.fetch(cache_key(source)) do
|
48
|
+
translation_domain = Tr8n::TranslationDomain.find_or_create(url)
|
41
49
|
translation_source = where("source = ? and translation_domain_id = ?", source, translation_domain.id).first
|
42
50
|
translation_source ||= create(:source => source, :translation_domain => translation_domain)
|
43
51
|
translation_source.update_attributes(:translation_domain => translation_domain) unless translation_source.translation_domain
|
@@ -46,7 +54,7 @@ class Tr8n::TranslationSource < ActiveRecord::Base
|
|
46
54
|
end
|
47
55
|
|
48
56
|
def clear_cache
|
49
|
-
Tr8n::Cache.delete(
|
57
|
+
Tr8n::Cache.delete(cache_key)
|
50
58
|
end
|
51
59
|
|
52
60
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-
|
2
|
+
# Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -40,29 +40,45 @@ class Tr8n::Translator < ActiveRecord::Base
|
|
40
40
|
|
41
41
|
belongs_to :fallback_language, :class_name => 'Tr8n::Language', :foreign_key => :fallback_language_id
|
42
42
|
|
43
|
+
def self.cache_key(user_id)
|
44
|
+
"translator_#{user_id}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def cache_key
|
48
|
+
self.class.cache_key(key)
|
49
|
+
end
|
50
|
+
|
43
51
|
def self.for(user)
|
44
52
|
return nil unless user and user.id
|
45
53
|
return nil if Tr8n::Config.guest_user?(user)
|
46
|
-
|
47
|
-
|
54
|
+
translator = Tr8n::Cache.fetch(cache_key(user.id)) do
|
55
|
+
find_by_user_id(user.id)
|
56
|
+
end
|
48
57
|
end
|
49
58
|
|
50
59
|
def self.find_or_create(user)
|
60
|
+
return nil unless user and user.id
|
61
|
+
|
51
62
|
trn = where(:user_id => user.id).first
|
52
63
|
trn = create(:user => user) unless trn
|
53
64
|
trn
|
54
65
|
end
|
55
66
|
|
56
67
|
def self.register(user = Tr8n::Config.current_user)
|
57
|
-
return unless user
|
58
|
-
|
59
68
|
translator = Tr8n::Translator.find_or_create(user)
|
69
|
+
return unless translator
|
70
|
+
|
71
|
+
# update all language user entries to add a translator id
|
60
72
|
Tr8n::LanguageUser.where(:user_id => user.id).each do |lu|
|
61
73
|
lu.update_attributes(:translator => translator)
|
62
74
|
end
|
63
75
|
translator
|
64
76
|
end
|
65
77
|
|
78
|
+
def self.top_translators_for_language(lang = Tr8n::Config.current_language, limit = 5)
|
79
|
+
Tr8n::TranslatorMetric.where(:language_id => lang.id).order("total_translations desc, total_votes desc").limit(limit)
|
80
|
+
end
|
81
|
+
|
66
82
|
def total_metric
|
67
83
|
@total_metric ||= Tr8n::TranslatorMetric.find_or_create(self, nil)
|
68
84
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2010-
|
2
|
+
# Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -83,11 +83,11 @@ class Tr8n::TranslatorLog < ActiveRecord::Base
|
|
83
83
|
html = action.to_s.gsub("_", " ")
|
84
84
|
act = action.to_sym
|
85
85
|
if [:got_blocked, :got_unblocked, :got_promoted, :got_demoted].include?(act)
|
86
|
-
html << " by " << user
|
86
|
+
html << " by " << Tr8n::Config.user_name(user) if user
|
87
87
|
html << " (" << reason << ")" unless reason.blank?
|
88
88
|
elsif [:got_new_level].include?(act)
|
89
89
|
html << " " << reference unless reference.blank?
|
90
|
-
html << " from " << user
|
90
|
+
html << " from " << Tr8n::Config.user_name(user) if user
|
91
91
|
html << " (" << reason << ")" unless reason.blank?
|
92
92
|
elsif [:enabled_inline_translations, :disabled_inline_translations].include?(act)
|
93
93
|
lang = Tr8n::Language.find_by_id(reference) unless reference.blank?
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
<div class="section_title">
|
4
4
|
<span style="font-size:12px; color:grey; float:right; padding-top:5px;">
|
5
|
-
|
5
|
+
<% unless Tr8n::Config.enable_client_sdk? %>
|
6
|
+
<span style="color:red">Make sure that JS Client SDK is enabled!</span>
|
7
|
+
<% end %>
|
6
8
|
</span>
|
7
9
|
|
8
10
|
Tr8n JavaScript Client SDK Test Tool
|
@@ -28,56 +30,48 @@
|
|
28
30
|
</td>
|
29
31
|
<td rowspan="3" style="width:15%; padding:2px; vertical-align:top;">
|
30
32
|
<center>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
</div>
|
33
|
+
<div style="width:150px; text-align:center; padding-top:15px;">
|
34
|
+
<button style="width:100%;" onClick="translate();return false;">Translate</button>
|
35
|
+
<button style="width:100%;" onClick="translate({skip_decorations:true});return false;">Translate Label</button>
|
36
|
+
<button style="width:100%;" onClick="searchPhrase();return false;">View Translation Key</button>
|
37
|
+
<br><br>
|
38
|
+
<button style="width:100%;" onClick="clearResults();return false;">Clear Results</button>
|
39
|
+
<button style="width:100%;" onClick="tr8nLightbox.show('/tr8n/admin/clientsdk/lb_samples', {height:500});return false;">View Examples</button>
|
40
|
+
<button style="width:100%;" onClick="reloadTranslations();return false;">Reload Translations</button>
|
41
|
+
<button style="width:100%;" onClick="tr8nProxy.logSettings();return false;">Print Settings</button>
|
42
|
+
<button style="width:100%;" onClick="tr8nProxy.logTranslations();return false;">Print Translation Cache</button>
|
43
|
+
</div>
|
44
44
|
</center>
|
45
45
|
</td>
|
46
46
|
</tr>
|
47
47
|
<tr>
|
48
48
|
<td colspan="2" style="padding:2px; background:#F1F4FA;">
|
49
49
|
<div style="font-weight:bold;">Tokens JSON <span style='color:grey'>- provides values for tokens used in translation. (required, if data tokens are defined)</span></div>
|
50
|
-
<%=text_area_tag(:tokens, "{'count':5}", :style => "width:99%; height:
|
50
|
+
<%=text_area_tag(:tokens, "{'count':5}", :style => "width:99%; height:50px;")%>
|
51
51
|
</td>
|
52
52
|
</tr>
|
53
53
|
<tr>
|
54
54
|
<td colspan="2" style="padding:2px;">
|
55
55
|
<div style="font-weight:bold; padding-top:10px;">Translation <span style='color:grey'>- translated label with substituted tokens</span></div>
|
56
56
|
<div id="result_html" style="background:#F9F8F7; height:40px; overflow:auto; border:1px dotted #ccc; padding:10px;"></div>
|
57
|
-
<div style="font-weight:bold; padding-top:10px; color:grey
|
58
|
-
<%=text_area_tag(:result, "", :style => "width:99%; background:#F9F8F7;", :readonly => true)%>
|
57
|
+
<div style="font-weight:bold; padding-top:10px;">Translation Raw HTML <span style='color:grey'>- translated label with substituted tokens</span></div>
|
58
|
+
<%=text_area_tag(:result, "", :style => "width:99%; background:#F9F8F7;height:50px; border:1px solid #ccc;", :readonly => true)%>
|
59
59
|
</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
<% end %>
|
63
63
|
</div>
|
64
64
|
|
65
|
-
<div id="
|
65
|
+
<div id="tr8n_debugger" class="section_box colored" style="font-size:10px; height:350px; overflow:auto; margin: 10px;">
|
66
66
|
</div>
|
67
67
|
|
68
|
-
<%=tr8n_translations_js_tag(:sources => ["clientsdk_examples"], :id => :tr8n_clientsdk_translations) %>
|
69
|
-
<%=tr8n_client_sdk_scripts_tag(
|
70
|
-
:default_source => "clientsdk_examples",
|
71
|
-
:debugger_element_id => "debugger",
|
72
|
-
:translations_element_id => "tr8n_clientsdk_translations",
|
73
|
-
:scheduler_interval => 5000
|
74
|
-
) %>
|
75
|
-
|
76
68
|
<script>
|
69
|
+
tr8nProxy.enableLogger();
|
70
|
+
|
77
71
|
function clearResults() {
|
78
|
-
Tr8n.element('debugger').innerHTML = '';
|
79
72
|
Tr8n.element('result').value = '';
|
80
73
|
Tr8n.element('result_html').innerHTML = '';
|
74
|
+
tr8nProxy.logger.clear();
|
81
75
|
}
|
82
76
|
|
83
77
|
function reloadTranslations() {
|
@@ -91,17 +85,23 @@
|
|
91
85
|
tr8nLightbox.hide();
|
92
86
|
}
|
93
87
|
|
94
|
-
function translate() {
|
88
|
+
function translate(opts) {
|
89
|
+
opts = opts || {};
|
95
90
|
var tokens = null;
|
96
91
|
|
97
92
|
if (Tr8n.element('tokens').value != "") {
|
98
93
|
tokens = eval("[" + Tr8n.value('tokens') + "]")[0];
|
99
94
|
}
|
100
95
|
|
101
|
-
Tr8n.element('result').value =
|
96
|
+
Tr8n.element('result').value = tr(Tr8n.value('label'), '', tokens, opts);
|
102
97
|
Tr8n.element('result_html').innerHTML = Tr8n.element('result').value;
|
103
98
|
}
|
104
99
|
|
100
|
+
function searchPhrase() {
|
101
|
+
url = "/tr8n/phrases/index?search=" + encodeURI(Tr8n.value('label'));
|
102
|
+
window.open(url,'translation_key');
|
103
|
+
}
|
104
|
+
|
105
105
|
function speedTest() {
|
106
106
|
var tokens = null;
|
107
107
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%
|
2
|
+
links = []
|
3
|
+
current_tab ||= ""
|
4
|
+
[
|
5
|
+
["Top Translators By Language", {:action => :index}],
|
6
|
+
].each do |link|
|
7
|
+
if controller.action_name == link.last[:action].to_s
|
8
|
+
current_tab = link.first if current_tab.blank?
|
9
|
+
links << link.first
|
10
|
+
else
|
11
|
+
links << link_to(link.first, link.last)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
%>
|
15
|
+
|
16
|
+
<div class="section_title">
|
17
|
+
<span style="font-size:12px; float:right; padding-top:5px;">
|
18
|
+
<%=links.join(" | ")%>
|
19
|
+
</span>
|
20
|
+
<%=current_tab %>
|
21
|
+
</div>
|
22
|
+
|