i18n-js 2.1.2 → 3.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +24 -0
  3. data/.gitignore +5 -4
  4. data/.npmignore +27 -0
  5. data/.travis.yml +37 -0
  6. data/Appraisals +20 -0
  7. data/CHANGELOG.md +354 -0
  8. data/Gemfile +1 -1
  9. data/README.md +872 -0
  10. data/Rakefile +19 -7
  11. data/app/assets/javascripts/i18n/filtered.js.erb +23 -0
  12. data/app/assets/javascripts/i18n/shims.js +208 -0
  13. data/app/assets/javascripts/i18n/translations.js +3 -0
  14. data/app/assets/javascripts/i18n.js +1077 -0
  15. data/gemfiles/i18n_0_6.gemfile +7 -0
  16. data/gemfiles/i18n_0_7.gemfile +7 -0
  17. data/gemfiles/i18n_0_8.gemfile +7 -0
  18. data/gemfiles/i18n_0_9.gemfile +7 -0
  19. data/gemfiles/i18n_1_0.gemfile +7 -0
  20. data/i18n-js.gemspec +11 -9
  21. data/lib/i18n/js/dependencies.rb +59 -0
  22. data/lib/i18n/js/engine.rb +87 -0
  23. data/lib/i18n/js/fallback_locales.rb +70 -0
  24. data/lib/{i18n-js → i18n/js}/middleware.rb +32 -9
  25. data/lib/i18n/js/private/hash_with_symbol_keys.rb +36 -0
  26. data/lib/i18n/js/segment.rb +88 -0
  27. data/lib/i18n/js/utils.rb +52 -0
  28. data/lib/i18n/js/version.rb +7 -0
  29. data/lib/i18n/js.rb +242 -0
  30. data/lib/i18n-js.rb +1 -177
  31. data/lib/rails/generators/i18n/js/config/config_generator.rb +19 -0
  32. data/{config → lib/rails/generators/i18n/js/config/templates}/i18n-js.yml +11 -6
  33. data/lib/tasks/export.rake +8 -0
  34. data/package.json +25 -0
  35. data/spec/fixtures/custom_path.yml +5 -0
  36. data/spec/fixtures/default.yml +5 -0
  37. data/spec/fixtures/erb.yml +5 -0
  38. data/spec/fixtures/except_condition.yml +7 -0
  39. data/spec/fixtures/js_export_dir_custom.yml +7 -0
  40. data/spec/fixtures/js_export_dir_none.yml +6 -0
  41. data/spec/fixtures/js_extend_parent.yml +6 -0
  42. data/spec/fixtures/js_extend_segment.yml +6 -0
  43. data/spec/fixtures/js_file_per_locale.yml +7 -0
  44. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_default_locale_symbol.yml +4 -0
  45. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_hash.yml +6 -0
  46. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale.yml +4 -0
  47. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale_without_fallback_translations.yml +4 -0
  48. data/spec/fixtures/js_file_per_locale_with_fallbacks_enabled.yml +4 -0
  49. data/spec/fixtures/js_file_per_locale_without_fallbacks.yml +4 -0
  50. data/spec/fixtures/js_file_with_namespace_and_pretty_print.yml +7 -0
  51. data/spec/fixtures/js_sort_translation_keys_false.yml +6 -0
  52. data/spec/fixtures/js_sort_translation_keys_true.yml +6 -0
  53. data/spec/{resources → fixtures}/locales.yml +13 -1
  54. data/spec/fixtures/multiple_conditions.yml +7 -0
  55. data/spec/fixtures/multiple_conditions_per_locale.yml +7 -0
  56. data/spec/fixtures/multiple_files.yml +7 -0
  57. data/spec/{resources → fixtures}/no_config.yml +0 -0
  58. data/spec/fixtures/no_scope.yml +4 -0
  59. data/spec/fixtures/simple_scope.yml +5 -0
  60. data/spec/js/currency.spec.js +62 -0
  61. data/spec/js/current_locale.spec.js +19 -0
  62. data/spec/js/dates.spec.js +265 -0
  63. data/spec/js/defaults.spec.js +31 -0
  64. data/spec/js/extend.spec.js +110 -0
  65. data/spec/js/interpolation.spec.js +124 -0
  66. data/spec/js/jasmine/MIT.LICENSE +20 -0
  67. data/spec/js/jasmine/jasmine-html.js +190 -0
  68. data/spec/js/jasmine/jasmine.css +166 -0
  69. data/spec/js/jasmine/jasmine.js +2476 -0
  70. data/spec/js/jasmine/jasmine_favicon.png +0 -0
  71. data/spec/js/locales.spec.js +31 -0
  72. data/spec/js/localization.spec.js +48 -0
  73. data/spec/js/numbers.spec.js +170 -0
  74. data/spec/js/placeholder.spec.js +24 -0
  75. data/spec/js/pluralization.spec.js +211 -0
  76. data/spec/js/prepare_options.spec.js +41 -0
  77. data/spec/js/require.js +2083 -0
  78. data/spec/js/specs.html +49 -0
  79. data/spec/js/specs_requirejs.html +72 -0
  80. data/spec/js/translate.spec.js +277 -0
  81. data/spec/js/translations.js +164 -0
  82. data/spec/js/utility_functions.spec.js +20 -0
  83. data/spec/ruby/i18n/js/fallback_locales_spec.rb +84 -0
  84. data/spec/ruby/i18n/js/segment_spec.rb +157 -0
  85. data/spec/ruby/i18n/js/utils_spec.rb +106 -0
  86. data/spec/ruby/i18n/js_spec.rb +627 -0
  87. data/spec/spec_helper.rb +55 -14
  88. data/yarn.lock +131 -0
  89. metadata +188 -96
  90. data/.rspec +0 -1
  91. data/Gemfile.lock +0 -51
  92. data/README.rdoc +0 -305
  93. data/lib/i18n-js/engine.rb +0 -62
  94. data/lib/i18n-js/railtie.rb +0 -13
  95. data/lib/i18n-js/rake.rb +0 -16
  96. data/lib/i18n-js/version.rb +0 -10
  97. data/spec/i18n_spec.js +0 -768
  98. data/spec/i18n_spec.rb +0 -205
  99. data/spec/resources/custom_path.yml +0 -4
  100. data/spec/resources/default.yml +0 -4
  101. data/spec/resources/js_file_per_locale.yml +0 -3
  102. data/spec/resources/multiple_conditions.yml +0 -6
  103. data/spec/resources/multiple_files.yml +0 -6
  104. data/spec/resources/no_scope.yml +0 -3
  105. data/spec/resources/simple_scope.yml +0 -4
  106. data/vendor/assets/javascripts/i18n/translations.js.erb +0 -7
  107. data/vendor/assets/javascripts/i18n.js +0 -450
data/lib/i18n/js.rb ADDED
@@ -0,0 +1,242 @@
1
+ require "yaml"
2
+ require "fileutils"
3
+ require "i18n"
4
+
5
+ require "i18n/js/utils"
6
+ require "i18n/js/private/hash_with_symbol_keys"
7
+
8
+ module I18n
9
+ module JS
10
+ require "i18n/js/dependencies"
11
+ require "i18n/js/fallback_locales"
12
+ require "i18n/js/segment"
13
+ if JS::Dependencies.rails?
14
+ require "i18n/js/middleware"
15
+ require "i18n/js/engine"
16
+ end
17
+
18
+ DEFAULT_CONFIG_PATH = "config/i18n-js.yml"
19
+ DEFAULT_EXPORT_DIR_PATH = "public/javascripts"
20
+
21
+ # The configuration file. This defaults to the `config/i18n-js.yml` file.
22
+ #
23
+ def self.config_file_path
24
+ @config_file_path ||= DEFAULT_CONFIG_PATH
25
+ end
26
+
27
+ def self.config_file_path=(new_path)
28
+ @config_file_path = new_path
29
+ end
30
+
31
+ # Export translations to JavaScript, considering settings
32
+ # from configuration file
33
+ def self.export
34
+ export_i18n_js
35
+
36
+ translation_segments.each(&:save!)
37
+ end
38
+
39
+ def self.segment_for_scope(scope, exceptions)
40
+ if scope == "*"
41
+ exclude(translations, exceptions)
42
+ else
43
+ scoped_translations(scope, exceptions)
44
+ end
45
+ end
46
+
47
+ def self.configured_segments
48
+ config[:translations].inject([]) do |segments, options_hash|
49
+ options_hash_with_symbol_keys = Private::HashWithSymbolKeys.new(options_hash)
50
+ file = options_hash_with_symbol_keys[:file]
51
+ only = options_hash_with_symbol_keys[:only] || '*'
52
+ exceptions = [options_hash_with_symbol_keys[:except] || []].flatten
53
+
54
+ result = segment_for_scope(only, exceptions)
55
+
56
+ merge_with_fallbacks!(result) if fallbacks
57
+
58
+ unless result.empty?
59
+ segments << Segment.new(
60
+ file,
61
+ result,
62
+ extract_segment_options(options_hash_with_symbol_keys),
63
+ )
64
+ end
65
+
66
+ segments
67
+ end
68
+ end
69
+
70
+ # deep_merge! given result with result for fallback locale
71
+ def self.merge_with_fallbacks!(result)
72
+ I18n.available_locales.each do |locale|
73
+ fallback_locales = FallbackLocales.new(fallbacks, locale)
74
+ fallback_locales.each do |fallback_locale|
75
+ # `result[fallback_locale]` could be missing
76
+ result[locale] = Utils.deep_merge(result[fallback_locale] || {}, result[locale] || {})
77
+ end
78
+ end
79
+ end
80
+
81
+ def self.filtered_translations
82
+ translations = {}.tap do |result|
83
+ translation_segments.each do |segment|
84
+ Utils.deep_merge!(result, segment.translations)
85
+ end
86
+ end
87
+ return Utils.deep_key_sort(translations) if I18n::JS.sort_translation_keys?
88
+ translations
89
+ end
90
+
91
+ def self.translation_segments
92
+ if config_file_exists? && config[:translations]
93
+ configured_segments
94
+ else
95
+ [Segment.new("#{DEFAULT_EXPORT_DIR_PATH}/translations.js", translations)]
96
+ end
97
+ end
98
+
99
+ # Load configuration file for partial exporting and
100
+ # custom output directory
101
+ def self.config
102
+ if config_file_exists?
103
+ erb_result_from_yaml_file = ERB.new(File.read(config_file_path)).result
104
+ Private::HashWithSymbolKeys.new(
105
+ (::YAML.load(erb_result_from_yaml_file) || {})
106
+ )
107
+ else
108
+ Private::HashWithSymbolKeys.new({})
109
+ end.freeze
110
+ end
111
+
112
+ # @api private
113
+ # Check if configuration file exist
114
+ def self.config_file_exists?
115
+ File.file? config_file_path
116
+ end
117
+
118
+ def self.scoped_translations(scopes, exceptions = []) # :nodoc:
119
+ result = {}
120
+
121
+ [scopes].flatten.each do |scope|
122
+ translations_without_exceptions = exclude(translations, exceptions)
123
+ filtered_translations = filter(translations_without_exceptions, scope) || {}
124
+
125
+ Utils.deep_merge!(result, filtered_translations)
126
+ end
127
+
128
+ result
129
+ end
130
+
131
+ # Exclude keys from translations listed in the `except:` section in the config file
132
+ def self.exclude(translations, exceptions)
133
+ return translations if exceptions.empty?
134
+
135
+ exceptions.inject(translations) do |memo, exception|
136
+ exception_scopes = exception.to_s.split(".")
137
+ Utils.deep_reject(memo) do |key, value, scopes|
138
+ Utils.scopes_match?(scopes, exception_scopes)
139
+ end
140
+ end
141
+ end
142
+
143
+ # Filter translations according to the specified scope.
144
+ def self.filter(translations, scopes)
145
+ scopes = scopes.split(".") if scopes.is_a?(String)
146
+ scopes = scopes.clone
147
+ scope = scopes.shift
148
+
149
+ if scope == "*"
150
+ results = {}
151
+ translations.each do |scope, translations|
152
+ tmp = scopes.empty? ? translations : filter(translations, scopes)
153
+ results[scope.to_sym] = tmp unless tmp.nil?
154
+ end
155
+ return results
156
+ elsif translations.respond_to?(:key?) && translations.key?(scope.to_sym)
157
+ return {scope.to_sym => scopes.empty? ? translations[scope.to_sym] : filter(translations[scope.to_sym], scopes)}
158
+ end
159
+ nil
160
+ end
161
+
162
+ # Initialize and return translations
163
+ def self.translations
164
+ ::I18n.backend.instance_eval do
165
+ init_translations unless initialized?
166
+ # When activesupport is absent,
167
+ # the core extension (`#slice`) from `i18n` gem will be used instead
168
+ # And it's causing errors (at least in test)
169
+ #
170
+ # So the input is wrapped by our class for better `#slice`
171
+ Private::HashWithSymbolKeys.new(translations).
172
+ slice(*::I18n.available_locales).
173
+ to_h
174
+ end
175
+ end
176
+
177
+ def self.use_fallbacks?
178
+ fallbacks != false
179
+ end
180
+
181
+ def self.fallbacks
182
+ config.fetch(:fallbacks) do
183
+ # default value
184
+ true
185
+ end
186
+ end
187
+
188
+ def self.js_extend
189
+ config.fetch(:js_extend) do
190
+ # default value
191
+ true
192
+ end
193
+ end
194
+
195
+ def self.sort_translation_keys?
196
+ @sort_translation_keys ||= (config[:sort_translation_keys]) if config.key?(:sort_translation_keys)
197
+ @sort_translation_keys = true if @sort_translation_keys.nil?
198
+ @sort_translation_keys
199
+ end
200
+
201
+ def self.sort_translation_keys=(value)
202
+ @sort_translation_keys = !!value
203
+ end
204
+
205
+ def self.extract_segment_options(options)
206
+ segment_options = Private::HashWithSymbolKeys.new({
207
+ js_extend: js_extend,
208
+ sort_translation_keys: sort_translation_keys?,
209
+ }).freeze
210
+ segment_options.merge(options.slice(*Segment::OPTIONS))
211
+ end
212
+
213
+ ### Export i18n.js
214
+ begin
215
+
216
+ # Copy i18n.js
217
+ def self.export_i18n_js
218
+ return unless export_i18n_js_dir_path.is_a? String
219
+
220
+ FileUtils.mkdir_p(export_i18n_js_dir_path)
221
+
222
+ i18n_js_path = File.expand_path('../../../app/assets/javascripts/i18n.js', __FILE__)
223
+ destination_path = File.expand_path("i18n.js", export_i18n_js_dir_path)
224
+ return if File.exist?(destination_path) && FileUtils.identical?(i18n_js_path, destination_path)
225
+
226
+ FileUtils.cp(i18n_js_path, export_i18n_js_dir_path)
227
+ end
228
+
229
+ def self.export_i18n_js_dir_path
230
+ @export_i18n_js_dir_path ||= (config[:export_i18n_js] || :none) if config.key?(:export_i18n_js)
231
+ @export_i18n_js_dir_path ||= DEFAULT_EXPORT_DIR_PATH
232
+ @export_i18n_js_dir_path
233
+ end
234
+
235
+ # Setting this to nil would disable i18n.js exporting
236
+ def self.export_i18n_js_dir_path=(new_path)
237
+ new_path = :none unless new_path.is_a? String
238
+ @export_i18n_js_dir_path = new_path
239
+ end
240
+ end
241
+ end
242
+ end
data/lib/i18n-js.rb CHANGED
@@ -1,177 +1 @@
1
- require "FileUtils" unless defined?(FileUtils)
2
-
3
- module SimplesIdeias
4
- module I18n
5
- extend self
6
-
7
- require "i18n-js/railtie" if Rails.version >= "3.0"
8
- require "i18n-js/engine" if Rails.version >= "3.1"
9
- require "i18n-js/middleware"
10
-
11
- # deep_merge by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809
12
- MERGER = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &MERGER) : v2 }
13
-
14
- # Under rails 3.1.1 and higher, perform a check to ensure that the
15
- # full environment will be available during asset compilation.
16
- # This is required to ensure I18n is loaded.
17
- def assert_usable_configuration!
18
- @usable_configuration ||= Rails.version >= "3.1.1" &&
19
- Rails.configuration.assets.initialize_on_precompile ||
20
- raise("Cannot precompile i18n-js translations unless environment is initialized. Please set config.assets.initialize_on_precompile to true.")
21
- end
22
-
23
- def has_asset_pipeline?
24
- Rails.configuration.respond_to?(:assets) && Rails.configuration.assets.enabled
25
- end
26
-
27
- def config_file
28
- Rails.root.join("config/i18n-js.yml")
29
- end
30
-
31
- def export_dir
32
- if has_asset_pipeline?
33
- "app/assets/javascripts/i18n"
34
- else
35
- "public/javascripts"
36
- end
37
- end
38
-
39
- def javascript_file
40
- Rails.root.join(export_dir, "i18n.js")
41
- end
42
-
43
- # Export translations to JavaScript, considering settings
44
- # from configuration file
45
- def export!
46
- translation_segments.each do |filename, translations|
47
- save(translations, filename)
48
- end
49
- end
50
-
51
- def segments_per_locale(pattern,scope)
52
- ::I18n.available_locales.each_with_object({}) do |locale,segments|
53
- result = scoped_translations("#{locale}.#{scope}")
54
- unless result.empty?
55
- segment_name = ::I18n.interpolate(pattern,{:locale => locale})
56
- segments[segment_name] = result
57
- end
58
- end
59
- end
60
-
61
- def segment_for_scope(scope)
62
- if scope == "*"
63
- translations
64
- else
65
- scoped_translations(scope)
66
- end
67
- end
68
-
69
- def configured_segments
70
- config[:translations].each_with_object({}) do |options,segments|
71
- options.reverse_merge!(:only => "*")
72
- if options[:file] =~ ::I18n::INTERPOLATION_PATTERN
73
- segments.merge!(segments_per_locale(options[:file],options[:only]))
74
- else
75
- result = segment_for_scope(options[:only])
76
- segments[options[:file]] = result unless result.empty?
77
- end
78
- end
79
- end
80
-
81
- def translation_segments
82
- if config? && config[:translations]
83
- configured_segments
84
- else
85
- {"#{export_dir}/translations.js" => translations}
86
- end
87
- end
88
-
89
- # Load configuration file for partial exporting and
90
- # custom output directory
91
- def config
92
- if config?
93
- (YAML.load_file(config_file) || {}).with_indifferent_access
94
- else
95
- {}
96
- end
97
- end
98
-
99
- # Check if configuration file exist
100
- def config?
101
- File.file? config_file
102
- end
103
-
104
- # Copy configuration and JavaScript library files to
105
- # <tt>config/i18n-js.yml</tt> and <tt>public/javascripts/i18n.js</tt>.
106
- def setup!
107
- FileUtils.cp(File.dirname(__FILE__) + "/../vendor/assets/javascripts/i18n.js", javascript_file) unless Rails.version >= "3.1"
108
- FileUtils.cp(File.dirname(__FILE__) + "/../config/i18n-js.yml", config_file) unless config?
109
- end
110
-
111
- # Retrieve an updated JavaScript library from Github.
112
- def update!
113
- require "open-uri"
114
- contents = open("https://raw.github.com/fnando/i18n-js/master/vendor/assets/javascripts/i18n.js").read
115
- File.open(javascript_file, "w+") {|f| f << contents}
116
- end
117
-
118
- # Convert translations to JSON string and save file.
119
- def save(translations, file)
120
- file = Rails.root.join(file)
121
- FileUtils.mkdir_p File.dirname(file)
122
-
123
- File.open(file, "w+") do |f|
124
- f << %(var I18n = I18n || {};\n)
125
- f << %(I18n.translations = );
126
- f << translations.to_json
127
- f << %(;)
128
- end
129
- end
130
-
131
- def scoped_translations(scopes) # :nodoc:
132
- result = {}
133
-
134
- [scopes].flatten.each do |scope|
135
- deep_merge! result, filter(translations, scope)
136
- end
137
-
138
- result
139
- end
140
-
141
- # Filter translations according to the specified scope.
142
- def filter(translations, scopes)
143
- scopes = scopes.split(".") if scopes.is_a?(String)
144
- scopes = scopes.clone
145
- scope = scopes.shift
146
-
147
- if scope == "*"
148
- results = {}
149
- translations.each do |scope, translations|
150
- tmp = scopes.empty? ? translations : filter(translations, scopes)
151
- results[scope.to_sym] = tmp unless tmp.nil?
152
- end
153
- return results
154
- elsif translations.has_key?(scope.to_sym)
155
- return {scope.to_sym => scopes.empty? ? translations[scope.to_sym] : filter(translations[scope.to_sym], scopes)}
156
- end
157
- nil
158
- end
159
-
160
- # Initialize and return translations
161
- def translations
162
- ::I18n.backend.instance_eval do
163
- init_translations unless initialized?
164
- translations
165
- end
166
- end
167
-
168
- def deep_merge(target, hash) # :nodoc:
169
- target.merge(hash, &MERGER)
170
- end
171
-
172
- def deep_merge!(target, hash) # :nodoc:
173
- target.merge!(hash, &MERGER)
174
- end
175
- end
176
- end
177
-
1
+ require "i18n/js"
@@ -0,0 +1,19 @@
1
+ module I18n
2
+ module Js
3
+ class ConfigGenerator < Rails::Generators::Base
4
+ # Copied files come from templates folder
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ # Generator desc
8
+ desc <<-DESC
9
+ Creates a default i18n-js.yml configuration file in your app's config
10
+ folder. This file allows you to customize i18n:js:export rake task
11
+ outputted files.
12
+ DESC
13
+
14
+ def copy_initializer_file
15
+ copy_file "i18n-js.yml", "config/i18n-js.yml"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,5 @@
1
1
  # Split context in several files.
2
+ #
2
3
  # By default only one file with all translations is exported and
3
4
  # no configuration is required. Your settings for asset pipeline
4
5
  # are automatically recognized.
@@ -7,16 +8,20 @@
7
8
  # locale contexts that will be exported, just use this file to do
8
9
  # so.
9
10
  #
11
+ # For more informations about the export options with this file, please
12
+ # refer to the README
13
+ #
14
+ #
10
15
  # If you're going to use the Rails 3.1 asset pipeline, change
11
16
  # the following configuration to something like this:
12
17
  #
13
- # translations:
14
- # - file: "app/assets/javascripts/i18n/translations.js"
18
+ # translations:
19
+ # - file: "app/assets/javascripts/i18n/translations.js"
15
20
  #
16
21
  # If you're running an old version, you can use something
17
22
  # like this:
18
23
  #
19
- # translations:
20
- # - file: "public/javascripts/translations.js"
21
- # only: "*"
22
- #
24
+ # translations:
25
+ # - file: "app/assets/javascripts/i18n/translations.js"
26
+ # only: "*"
27
+ #
@@ -0,0 +1,8 @@
1
+ namespace :i18n do
2
+ namespace :js do
3
+ desc "Export translations to JS file(s)"
4
+ task :export => :environment do
5
+ I18n::JS.export
6
+ end
7
+ end
8
+ end
data/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "i18n-js",
3
+ "version": "3.0.11",
4
+ "description": "A javascript library similar to Ruby on Rails i18n gem",
5
+ "author": "Nando Vieira",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "i18n"
9
+ ],
10
+ "devDependencies": {
11
+ "jasmine-node": "^1.14.5"
12
+ },
13
+ "main": "app/assets/javascripts/i18n.js",
14
+ "scripts": {
15
+ "test": "./node_modules/.bin/jasmine-node spec/js"
16
+ },
17
+ "homepage": "https://github.com/fnando/i18n-js",
18
+ "bugs": {
19
+ "url": "https://github.com/fnando/i18n-js/issues"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/fnando/i18n-js.git"
24
+ }
25
+ }
@@ -0,0 +1,5 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/all.js"
5
+ only: "*"
@@ -0,0 +1,5 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/translations.js"
5
+ only: "*"
@@ -0,0 +1,5 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/translations.js"
5
+ only: '<%= "*." + "date." + "formats" %>'
@@ -0,0 +1,7 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/trimmed.js"
5
+ except:
6
+ - "active_admin"
7
+ - "mailers"
@@ -0,0 +1,7 @@
1
+ fallbacks: false
2
+
3
+ export_i18n_js: 'tmp/i18n-js/foo'
4
+
5
+ translations:
6
+ - file: "tmp/i18n-js/%{locale}.js"
7
+ only: '*'
@@ -0,0 +1,6 @@
1
+ fallbacks: false
2
+ export_i18n_js: false
3
+
4
+ translations:
5
+ - file: "tmp/i18n-js/%{locale}.js"
6
+ only: '*'
@@ -0,0 +1,6 @@
1
+ fallbacks: false
2
+ js_extend: false
3
+
4
+ translations:
5
+ - file: "tmp/i18n-js/js_extend_parent.js"
6
+ only: "*.date.formats"
@@ -0,0 +1,6 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/js_extend_segment.js"
5
+ js_extend: false
6
+ only: "*.date.formats"
@@ -0,0 +1,7 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/%{locale}.js"
5
+ only:
6
+ - '*.date.*'
7
+ - '*.admin.*'
@@ -0,0 +1,4 @@
1
+ fallbacks: :default_locale
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/%{locale}.js"
@@ -0,0 +1,6 @@
1
+ fallbacks:
2
+ fr: ["de", "en"]
3
+ de: "en"
4
+
5
+ translations:
6
+ - file: "tmp/i18n-js/%{locale}.js"
@@ -0,0 +1,4 @@
1
+ fallbacks: :de
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/%{locale}.js"
@@ -0,0 +1,4 @@
1
+ fallbacks: :pirate
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/%{locale}.js"
@@ -0,0 +1,4 @@
1
+ fallbacks: true
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/%{locale}.js"
@@ -0,0 +1,4 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/%{locale}.js"
@@ -0,0 +1,7 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/%{locale}.js"
5
+ only: '*'
6
+ namespace: "Foo"
7
+ pretty_print: true
@@ -0,0 +1,6 @@
1
+
2
+ sort_translation_keys: false
3
+
4
+ translations:
5
+ - file: "tmp/i18n-js/%{locale}.js"
6
+ only: '*'
@@ -0,0 +1,6 @@
1
+
2
+ sort_translation_keys: true
3
+
4
+ translations:
5
+ - file: "tmp/i18n-js/%{locale}.js"
6
+ only: '*'
@@ -34,6 +34,13 @@ en:
34
34
  note: "more details"
35
35
  edit:
36
36
  title: "Edit"
37
+ foo: "Foo"
38
+ fallback_test: "Success"
39
+ null_test: "fallback for null"
40
+
41
+ de:
42
+ fallback_test: "Erfolg"
43
+ null_test: ~
37
44
 
38
45
  fr:
39
46
  date:
@@ -73,4 +80,9 @@ fr:
73
80
  title: "Visualiser"
74
81
  note: "plus de détails"
75
82
  edit:
76
- title: "Editer"
83
+ title: "Editer"
84
+
85
+ ja:
86
+ admin:
87
+ show:
88
+ title: "Ignore me"
@@ -0,0 +1,7 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/bitsnpieces.js"
5
+ only:
6
+ - "*.date.formats"
7
+ - "*.number.currency"
@@ -0,0 +1,7 @@
1
+ fallbacks: false
2
+
3
+ translations:
4
+ - file: "tmp/i18n-js/bits.%{locale}.js"
5
+ only:
6
+ - "*.date.formats.*"
7
+ - "*.number.currency.*"