translation 1.35 → 1.36

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25024c8116a0d36bc5821cde349f43434bbe1e56b2e1d60ba022262c4a8d9b7f
4
- data.tar.gz: c75ed4fe9ece108a76871d47fb606a0ab0551f53001b009ab0ae0069b0ec03dd
3
+ metadata.gz: e636552d35e488800b2e69f3555d818ae351f8adead0c682f17d424efaa8ff3f
4
+ data.tar.gz: fbb85ef559098ed37d7571d31ba31f34f69a2eacf162d4da9ffc33e35d426313
5
5
  SHA512:
6
- metadata.gz: 7377de5d6b6133dca3cdb1ba8fbcd96e4d17c9c294ecff05c1233bc4f1936221b32f293c606298e24ca9b9408c9c4be2151e2c7114e26413bbf7996556b78adf
7
- data.tar.gz: 84b2bda89cebcc32b655dd46210a8c4196e79a7e15588cb5c72956a9fe167d6cd9143d7d26e43064de790ad6671bf29030060fe8079127655123ae7516682dbe
6
+ metadata.gz: cf5c428012f2d4a615a01dc004c3079a9e675b95f1754598053422861e2fb354ec5fd9e8aaf7790c8dae9f8c1a560c6bddb06c9f75d04a062fbca9d6104462ad
7
+ data.tar.gz: 30d1f01243637205bae1e7a6bf26180b929028f046a240f4325e55af2a3736a1da663a9c376c0d27afc6eb067a70df24496494b2f27b2eb2c618811fce46f5df
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:
@@ -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
 
@@ -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
 
@@ -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.36'
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-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gettext
@@ -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: