translation 1.35 → 1.37

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25024c8116a0d36bc5821cde349f43434bbe1e56b2e1d60ba022262c4a8d9b7f
4
- data.tar.gz: c75ed4fe9ece108a76871d47fb606a0ab0551f53001b009ab0ae0069b0ec03dd
3
+ metadata.gz: 1aa63e584ea2e2064a46f87fdba20f387135bb3379c7ab85eaf6383a312cca59
4
+ data.tar.gz: d77f0d69b67ab0e112a7f27da673199fe091df0230643893356b38a67653145b
5
5
  SHA512:
6
- metadata.gz: 7377de5d6b6133dca3cdb1ba8fbcd96e4d17c9c294ecff05c1233bc4f1936221b32f293c606298e24ca9b9408c9c4be2151e2c7114e26413bbf7996556b78adf
7
- data.tar.gz: 84b2bda89cebcc32b655dd46210a8c4196e79a7e15588cb5c72956a9fe167d6cd9143d7d26e43064de790ad6671bf29030060fe8079127655123ae7516682dbe
6
+ metadata.gz: 483b2b4f922ed667b465d2a6ac551f0df46188c52859c2dc93951c2ea7f595af79055161e09ca88260bf23849514e0282257a02834455d768e264dcd6b39a5a3
7
+ data.tar.gz: 9b0fe16f145640b20add0c2476e01f335be0692c31b53041b4768c366c45ec80dd0be7fa13354895335afc5073ec95a457b193f86827a45f792ccbcb55395df6
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [Translation.io](https://translation.io) client for Ruby on Rails
1
+ # [Translation.io](https://translation.io/rails) client for Ruby on Rails
2
2
 
3
3
  [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
4
4
  [![Build Status](https://github.com/translation/rails/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/translation/rails/actions/workflows/test.yml)
@@ -10,7 +10,7 @@ Add this gem to localize your **Ruby on Rails** application.
10
10
 
11
11
  Use the official Rails syntax (with [YAML](#i18n-yaml) files) or use the [GetText](#gettext) syntax.
12
12
 
13
- Write only the source text, and keep it synchronized with your translators on [Translation.io](https://translation.io).
13
+ Write only the source text, and keep it synchronized with your translators on [Translation.io](https://translation.io/rails).
14
14
 
15
15
  <a href="https://translation.io/rails">
16
16
  <img width="720px" alt="Translation.io interface" src="https://translation.io/gifs/translation.gif">
@@ -65,7 +65,7 @@ Need help? [contact@translation.io](mailto:contact@translation.io)
65
65
 
66
66
  ### I18n (YAML)
67
67
 
68
- The default [Rails Internationalization API](http://guides.rubyonrails.org/i18n.html).
68
+ The default [Rails Internationalization API](https://guides.rubyonrails.org/i18n.html).
69
69
 
70
70
  ~~~ruby
71
71
  # Regular
@@ -128,7 +128,7 @@ More information about GetText syntax [here](https://github.com/ruby-gettext/get
128
128
  gem 'translation'
129
129
  ~~~
130
130
 
131
- 2. Create a new translation project [from the UI](https://translation.io).
131
+ 2. Create a new translation project [from the UI](https://translation.io/rails).
132
132
  3. Copy the initializer into your Rails app (`config/initializers/translation.rb`)
133
133
 
134
134
  The initializer looks like this:
@@ -144,7 +144,7 @@ end
144
144
  4. Initialize your project and push existing translations to Translation.io with:
145
145
 
146
146
  ~~~bash
147
- $ bundle exec rake translation:init
147
+ bundle exec rake translation:init
148
148
  ~~~
149
149
 
150
150
  If you need to add or remove languages in the future, please read our
@@ -157,7 +157,7 @@ If you need to add or remove languages in the future, please read our
157
157
  To send new translatable keys/strings and get new translations from Translation.io, simply run:
158
158
 
159
159
  ~~~bash
160
- $ bundle exec rake translation:sync
160
+ bundle exec rake translation:sync
161
161
  ~~~
162
162
 
163
163
  ### Sync and Show Purgeable
@@ -165,7 +165,7 @@ $ bundle exec rake translation:sync
165
165
  If you need to find out what are the unused keys/strings from Translation.io, using the current branch as reference:
166
166
 
167
167
  ~~~bash
168
- $ bundle exec rake translation:sync_and_show_purgeable
168
+ bundle exec rake translation:sync_and_show_purgeable
169
169
  ~~~
170
170
 
171
171
  As the name says, this operation will also perform a sync at the same time.
@@ -175,7 +175,7 @@ As the name says, this operation will also perform a sync at the same time.
175
175
  If you need to remove unused keys/strings from Translation.io, using the current branch as reference:
176
176
 
177
177
  ~~~bash
178
- $ bundle exec rake translation:sync_and_purge
178
+ bundle exec rake translation:sync_and_purge
179
179
  ~~~
180
180
 
181
181
  As the name says, this operation will also perform a sync at the same time.
@@ -274,7 +274,7 @@ The `set_locale` code is [here](https://github.com/translation/rails/blob/master
274
274
  feel free to override it with your own locale management.
275
275
 
276
276
  Don't forget to define your available locales with
277
- [I18n.available_locales](http://guides.rubyonrails.org/i18n.html#setup-the-rails-application-for-internationalization).
277
+ [I18n.available_locales](https://guides.rubyonrails.org/i18n.html#setup-the-rails-application-for-internationalization).
278
278
 
279
279
  More examples here: https://translation.io/blog/set-current-locale-in-your-rails-app
280
280
 
@@ -348,7 +348,7 @@ In both case, in your React component, you can simply call
348
348
  ### Using our official React & JavaScript package
349
349
 
350
350
  As Translation.io is directly integrated in the great
351
- [Lingui](https://lingui.js.org/) internationalization framework,
351
+ [Lingui](https://lingui.dev/) internationalization framework,
352
352
  you can also consider frontend localization as a completely different
353
353
  localization project.
354
354
 
@@ -368,7 +368,7 @@ a queue but it returns an error under heavy load), we implemented this
368
368
  threadsafe readonly task:
369
369
 
370
370
  ~~~bash
371
- $ bundle exec rake translation:sync_readonly
371
+ bundle exec rake translation:sync_readonly
372
372
  ~~~
373
373
 
374
374
  This task will prevent your CI from failing and still provide new translations. But
@@ -442,7 +442,7 @@ with percent signs or spaces) that he might break.
442
442
  We think localization is part of the configuration of the app and it should not reach the translator UI at all.
443
443
  That's why these localization keys are detected and separated on a dedicated YAML file with Translation.io.
444
444
 
445
- We automatically treat [known localization keys](lib/translation_io/yaml_entry.rb), but if you would like
445
+ We automatically treat [known localization keys](https://github.com/translation/rails/blob/master/lib/translation_io/yaml_entry.rb), but if you would like
446
446
  to add some more, use the `localization_key_prefixes` option.
447
447
 
448
448
  For example:
@@ -461,8 +461,8 @@ If you are using GetText and you want to manage other file formats than:
461
461
 
462
462
  * `rb`, `ruby` and `rabl` for Ruby.
463
463
  * `erb` and `inky` for Ruby templating.
464
- * `haml` and `mjmlhaml` for [HAML](http://haml.info/).
465
- * `slim` and `mjmlslim` for [SLIM](http://slim-lang.com/).
464
+ * `haml` and `mjmlhaml` for [HAML](https://haml.info/).
465
+ * `slim` and `mjmlslim` for [SLIM](https://github.com/slim-template/slim).
466
466
 
467
467
  Just add them in your configuration file like this:
468
468
 
@@ -587,7 +587,7 @@ This gem was created specifically for Rails, but you can also use it in a pure R
587
587
  To run the specs:
588
588
 
589
589
  ~~~bash
590
- $ bundle exec rspec
590
+ bundle exec rspec
591
591
  ~~~
592
592
 
593
593
  ## Contributing
@@ -626,7 +626,7 @@ Credits: [@armandsar](https://github.com/armandsar), [@michaelhoste](https://git
626
626
  Officially supported on [https://translation.io/lingui](https://translation.io/lingui)
627
627
 
628
628
  Translation.io is directly integrated in the great
629
- [Lingui](https://lingui.js.org/) internationalization project.
629
+ [Lingui](https://lingui.dev/) internationalization project.
630
630
 
631
631
  * GitHub: https://github.com/translation/lingui
632
632
  * NPM: https://www.npmjs.com/package/@translation/lingui
@@ -656,6 +656,6 @@ if you need some help or if you want to share your library.
656
656
  ## License
657
657
 
658
658
  The [translation gem](https://rubygems.org/gems/translation) in released under MIT license by
659
- [Aurélien Malisart](http://aurelien.malisart.be) and [Michaël Hoste](https://80limit.com) (see [LICENSE](LICENSE) file).
659
+ [Aurélien Malisart](https://aurelien.malisart.be) and [Michaël Hoste](https://80limit.com) (see [LICENSE](LICENSE) file).
660
660
 
661
661
  (c) [https://translation.io](https://translation.io) / [contact@translation.io](mailto:contact@translation.io)
@@ -12,30 +12,28 @@ module TranslationIO
12
12
  def run
13
13
  @yaml_file_paths.each do |locale_file_path|
14
14
  if locale_file_removable?(locale_file_path)
15
- if File.exist?(locale_file_path)
16
- content_hash = TranslationIO.yaml_load(File.read(locale_file_path)) || {}
17
- source_content_hash = content_hash.select { |k| k.to_s == @source_locale.to_s }
15
+ content_hash = TranslationIO.yaml_load(File.read(locale_file_path)) || {}
16
+ source_content_hash = content_hash.reject { |k| k.to_s.in?(@target_locales.collect(&:to_s)) }
18
17
 
19
- if source_content_hash.empty?
20
- TranslationIO.info "Removing #{locale_file_path}", 2, 2
21
- FileUtils.rm(locale_file_path)
22
- elsif content_hash != source_content_hash # in case of mixed languages in source YAML file
23
- TranslationIO.info "Rewriting #{locale_file_path}", 2, 2
18
+ if source_content_hash.empty?
19
+ TranslationIO.info "Removing #{locale_file_path}", 2, 2
20
+ FileUtils.rm(locale_file_path)
21
+ elsif content_hash != source_content_hash # in case of mixed languages in source YAML file
22
+ TranslationIO.info "Rewriting #{locale_file_path}", 2, 2
24
23
 
25
- if TranslationIO.config.yaml_line_width
26
- file_content = source_content_hash.to_yaml(:line_width => TranslationIO.config.yaml_line_width)
27
- else
28
- file_content = source_content_hash.to_yaml
29
- end
24
+ if TranslationIO.config.yaml_line_width
25
+ file_content = source_content_hash.to_yaml(:line_width => TranslationIO.config.yaml_line_width)
26
+ else
27
+ file_content = source_content_hash.to_yaml
28
+ end
30
29
 
31
- file_content = file_content.gsub(/ $/, '') # remove trailing spaces
30
+ file_content = file_content.gsub(/ $/, '') # remove trailing spaces
32
31
 
33
- File.open(locale_file_path, 'wb') do |file|
34
- file.write(file_content)
35
- end
36
- else
37
- # don't touch source
32
+ File.open(locale_file_path, 'wb') do |file|
33
+ file.write(file_content)
38
34
  end
35
+ else
36
+ # don't touch source
39
37
  end
40
38
  end
41
39
  end
@@ -44,6 +42,7 @@ module TranslationIO
44
42
  private
45
43
 
46
44
  def locale_file_removable?(locale_file_path)
45
+ exists = File.exist?(locale_file_path)
47
46
  in_project = locale_file_path_in_project?(locale_file_path)
48
47
 
49
48
  protected_file = @target_locales.any? do |target_locale|
@@ -55,7 +54,7 @@ module TranslationIO
55
54
  paths.include?(TranslationIO.normalize_path(locale_file_path))
56
55
  end
57
56
 
58
- in_project && !protected_file
57
+ exists && in_project && !protected_file
59
58
  end
60
59
 
61
60
  def locale_file_path_in_project?(locale_file_path)
@@ -1,7 +1,7 @@
1
1
  module TranslationIO
2
2
  module Extractor
3
3
  # visual: https://www.debuggex.com/r/fYSQ-jwQfTjhhE6T
4
- # .*? is non-greedy (lazy) match : http://stackoverflow.com/a/1919995/1243212
4
+ # .*? is non-greedy (lazy) match : https://stackoverflow.com/a/1919995/1243212
5
5
  REGEXP_INSIDE_1 = '\s*(?:\[?(?:(?:(?:".*?")|(?:\'.*?\'))\s*?,?\s*?){1}\]?)\s*?'
6
6
  REGEXP_INSIDE_2 = '\s*(?:\[?(?:(?:(?:".*?")|(?:\'.*?\'))\s*?,?\s*?){2}\]?),?\s*?.*?\s*'
7
7
  REGEXP_INSIDE_2B = '\s*(?:\[?(?:(?:(?:".*?")|(?:\'.*?\'))\s*?,?\s*?){2}\]?)\s*?'
@@ -50,7 +50,7 @@ namespace :translation do
50
50
  true
51
51
  else
52
52
  TranslationIO.info("[Error] Can't configure client. Did you set up the initializer?\n"\
53
- "Read usage instructions here : http://translation.io/usage")
53
+ "Read usage instructions here : https://translation.io/rails/usage")
54
54
  false
55
55
  end
56
56
  end
@@ -39,9 +39,7 @@ module TranslationIO
39
39
  end
40
40
 
41
41
  def localization_prefix?(key)
42
- localization_key_prefixes.any? do |prefix|
43
- key_without_locale(key).match(/^#{Regexp.escape(prefix)}\b/) != nil
44
- end
42
+ localization_key_prefixes.any? { |prefix| key_without_locale(key).match(/^#{Regexp.escape(prefix)}\b/) != nil }
45
43
  end
46
44
 
47
45
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translation
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.35'
4
+ version: '1.37'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hoste
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-12 00:00:00.000000000 Z
12
+ date: 2023-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gettext
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: 3.2.5
24
24
  - - "<="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.4.3
26
+ version: 3.4.4
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
@@ -36,7 +36,7 @@ dependencies:
36
36
  version: 3.2.5
37
37
  - - "<="
38
38
  - !ruby/object:Gem::Version
39
- version: 3.4.3
39
+ version: 3.4.4
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rake
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -131,7 +131,7 @@ licenses:
131
131
  metadata:
132
132
  bug_tracker_uri: https://github.com/translation/rails/issues
133
133
  changelog_uri: https://github.com/translation/rails/blob/master/CHANGELOG.md
134
- documentation_uri: https://translation.io/usage
134
+ documentation_uri: https://translation.io/rails/usage
135
135
  homepage_uri: https://translation.io
136
136
  source_code_uri: https://github.com/translation/rails
137
137
  post_install_message: