pseudolocalization 0.8.4 → 0.9.1
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 +4 -4
- data/.github/dependabot.yml +14 -0
- data/.github/workflows/cla.yml +22 -0
- data/.github/workflows/ruby-ci.yml +9 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +11 -1
- data/Gemfile +1 -7
- data/Gemfile.lock +3 -35
- data/README.md +26 -9
- data/dev.yml +1 -1
- data/lib/pseudolocalization/version.rb +1 -1
- data/lib/pseudolocalization.rb +46 -0
- data/pseudolocalization.gemspec +6 -0
- data/service.yml +1 -9
- data/{shipit.yml → shipit.rubygems.yml} +0 -4
- metadata +13 -11
- data/.dependabot/config.yml +0 -13
- data/.github/probots.yml +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 953fc8645d51046e0ea9f3cf943d07d297f0e69894aea97ae986ea3793949eff
|
4
|
+
data.tar.gz: f2c5c2ff02cb1c8491794a0c48ccc7e045a95880d10a67b889e7a7ac1dd4592d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21a1bc280d86b3f1c666f48c69fee633e047eae3cfc662c2bcde713acc2554575749557e01dce83c5629605db15a252d724dc4dc2560b45409ce0b0bb73c830e
|
7
|
+
data.tar.gz: f5324b187dc3c3113e486f90a89f9e1e2979286f732c5402fac5ac624e138eb2172bb4afa3a70d185912889a1c445deb6176af9fd4a8a39a0b4f9b67b66a0f07
|
@@ -0,0 +1,14 @@
|
|
1
|
+
version: 2
|
2
|
+
|
3
|
+
updates:
|
4
|
+
- package-ecosystem: bundler
|
5
|
+
directory: "/"
|
6
|
+
schedule:
|
7
|
+
interval: weekly
|
8
|
+
time: "10:00"
|
9
|
+
timezone: America/Toronto
|
10
|
+
open-pull-requests-limit: 99
|
11
|
+
reviewers:
|
12
|
+
- Shopify/intl-languages
|
13
|
+
registries:
|
14
|
+
- rubygems-server-pkgs-shopify-io
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Contributor License Agreement (CLA)
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request_target:
|
5
|
+
types: [opened, synchronize]
|
6
|
+
issue_comment:
|
7
|
+
types: [created]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
cla:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
if: |
|
13
|
+
(github.event.issue.pull_request
|
14
|
+
&& !github.event.issue.pull_request.merged_at
|
15
|
+
&& contains(github.event.comment.body, 'signed')
|
16
|
+
)
|
17
|
+
|| (github.event.pull_request && !github.event.pull_request.merged)
|
18
|
+
steps:
|
19
|
+
- uses: Shopify/shopify-cla-action@v1
|
20
|
+
with:
|
21
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
22
|
+
cla-token: ${{ secrets.CLA_TOKEN }}
|
@@ -1,7 +1,12 @@
|
|
1
1
|
name: CI
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- '**'
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
5
10
|
|
6
11
|
jobs:
|
7
12
|
build:
|
@@ -12,11 +17,11 @@ jobs:
|
|
12
17
|
strategy:
|
13
18
|
matrix:
|
14
19
|
version:
|
15
|
-
- 2.4
|
16
|
-
- 2.5
|
17
|
-
- 2.6
|
18
20
|
- 2.7
|
19
21
|
- 3.0
|
22
|
+
- 3.1
|
23
|
+
- 3.2
|
24
|
+
- 3.3
|
20
25
|
gemfile:
|
21
26
|
- Gemfile
|
22
27
|
steps:
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.5
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
6
|
## Unreleased
|
7
7
|
Nil.
|
8
8
|
|
9
|
+
## [0.9.1] - 2024-06-27
|
10
|
+
### Added
|
11
|
+
- Added support for pseudolocalized translations [#82](https://github.com/Shopify/pseudolocalization/pull/82)
|
12
|
+
|
13
|
+
## [0.9.0] - 2021-02-17
|
14
|
+
### Added
|
15
|
+
- Added support for ignoring specific translation keys [#59](https://github.com/Shopify/pseudolocalization/pull/59)
|
16
|
+
|
9
17
|
## [0.8.4] - 2021-01-15
|
10
18
|
### Added
|
11
19
|
- Added support for Ruby 3. [#53](https://github.com/Shopify/pseudolocalization/pull/53)
|
@@ -48,7 +56,9 @@ Nil.
|
|
48
56
|
|
49
57
|
Please refer to [GitHub releases](https://github.com/Shopify/pseudolocalization/releases) for releases prior to [0.8.0].
|
50
58
|
|
51
|
-
[Unreleased]: https://github.com/Shopify/pseudolocalization/compare/0.
|
59
|
+
[Unreleased]: https://github.com/Shopify/pseudolocalization/compare/0.9.1...HEAD
|
60
|
+
[0.9.1]: https://github.com/Shopify/pseudolocalization/compare/0.9.0...0.9.1
|
61
|
+
[0.9.0]: https://github.com/Shopify/pseudolocalization/compare/0.8.4...0.9.0
|
52
62
|
[0.8.4]: https://github.com/Shopify/pseudolocalization/compare/0.8.3...0.8.4
|
53
63
|
[0.8.3]: https://github.com/Shopify/pseudolocalization/compare/0.8.2...0.8.3
|
54
64
|
[0.8.2]: https://github.com/Shopify/pseudolocalization/compare/0.8.1...0.8.2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,53 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pseudolocalization (0.
|
4
|
+
pseudolocalization (0.9.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
unf (>= 0.0.5, < 1.0.0)
|
11
|
-
highline (1.6.20)
|
12
|
-
http-accept (1.7.0)
|
13
|
-
http-cookie (1.0.3)
|
14
|
-
domain_name (~> 0.5)
|
15
|
-
json_pure (1.8.1)
|
16
|
-
mime-types (3.2.2)
|
17
|
-
mime-types-data (~> 3.2015)
|
18
|
-
mime-types-data (3.2019.0331)
|
19
|
-
minitest (5.14.3)
|
20
|
-
netrc (0.11.0)
|
21
|
-
package_cloud (0.3.05)
|
22
|
-
highline (= 1.6.20)
|
23
|
-
json_pure (= 1.8.1)
|
24
|
-
rainbow (= 2.2.2)
|
25
|
-
rest-client (~> 2.0)
|
26
|
-
thor (~> 0.18)
|
27
|
-
rainbow (2.2.2)
|
28
|
-
rake
|
9
|
+
minitest (5.14.4)
|
29
10
|
rake (13.0.3)
|
30
|
-
rest-client (2.1.0)
|
31
|
-
http-accept (>= 1.7.0, < 2.0)
|
32
|
-
http-cookie (>= 1.0.2, < 2.0)
|
33
|
-
mime-types (>= 1.16, < 4.0)
|
34
|
-
netrc (~> 0.8)
|
35
|
-
thor (0.20.3)
|
36
|
-
unf (0.1.4)
|
37
|
-
unf_ext
|
38
|
-
unf_ext (0.0.7.6)
|
39
11
|
|
40
12
|
PLATFORMS
|
41
13
|
ruby
|
42
14
|
|
43
15
|
DEPENDENCIES
|
44
16
|
minitest (~> 5.0)
|
45
|
-
package_cloud
|
46
17
|
pseudolocalization!
|
47
18
|
rake (~> 13.0)
|
48
19
|
|
49
|
-
RUBY VERSION
|
50
|
-
ruby 3.0.0p0
|
51
|
-
|
52
20
|
BUNDLED WITH
|
53
|
-
2.2.
|
21
|
+
2.2.22
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# Pseudolocalization
|
1
|
+
# Pseudolocalization
|
2
2
|
|
3
|
-
[gem]
|
4
|
-
[gem_url]: https://rubygems.org/gems/pseudolocalization
|
3
|
+
[![Version][gem]][gem_url] [](https://github.com/Shopify/pseudolocalization/actions?query=workflow%3ACI)
|
5
4
|
|
6
|
-
|
5
|
+
[About this repo](#about-this-repo) | [How to use this repo](#how-to-use-this-repo) | [Contribute to this repo](#contribute-to-this-repo)
|
7
6
|
|
8
|
-
##
|
7
|
+
## About this repo
|
8
|
+
### Why?
|
9
9
|
|
10
10
|
Internationalization is a hard and tedious process. Different character sets, different average word length, different pluralization rules... There's a lot going on and it's impossible to test against all possible scenarios. As a side effect, most of us will simply test against one or two known languages and hope for the best. Unfortunately, this often leads to broken UI elements, texts going out of bounds, or forgotten non-translated strings making their way into a final release.
|
11
11
|
|
@@ -25,7 +25,8 @@ In an attempt to ease this whole process, we created a small tool that gives you
|
|
25
25
|
2. Expand words by doubling all vowels
|
26
26
|
3. Use English lookalike UTF8 characters for readability
|
27
27
|
|
28
|
-
##
|
28
|
+
## How to use this repo
|
29
|
+
### Installation
|
29
30
|
|
30
31
|
Add these lines to your application's Gemfile:
|
31
32
|
|
@@ -51,7 +52,7 @@ if Rails.env.development? && ENV["I18N_BACKEND"]
|
|
51
52
|
end
|
52
53
|
```
|
53
54
|
|
54
|
-
|
55
|
+
### Usage
|
55
56
|
|
56
57
|
When working on internationalization, you can boot your server with the pseudolocalization backend to quickly identify content that doesn't go through the I18n framework.
|
57
58
|
|
@@ -59,8 +60,21 @@ When working on internationalization, you can boot your server with the pseudolo
|
|
59
60
|
I18N_BACKEND=pseudolocalization bundle exec rails server
|
60
61
|
```
|
61
62
|
|
63
|
+
### Ignoring specific keys
|
64
|
+
You may wish to have the backend ignore specific keys. These may be configured via an array, `ignores`, on the backend. The array can contain a mix of strings (with globbing allowed) and/or Regexes.
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
I18n.backend = Pseudolocalization::I18n::Backend.new(I18n.backend)
|
68
|
+
I18n.backend.ignores = ['ignored*', /Waldo.$/]
|
69
|
+
```
|
70
|
+
|
71
|
+
### How to run tests
|
62
72
|
|
63
|
-
|
73
|
+
```bash
|
74
|
+
bundle exec rake test
|
75
|
+
```
|
76
|
+
|
77
|
+
### Other Resources
|
64
78
|
|
65
79
|
* [IBM Globalization Guidelines](http://www-01.ibm.com/software/globalization/guidelines/index.html)
|
66
80
|
* [Design for internationalization - Dropbox Design](https://medium.com/dropbox-design/design-for-internationalization-24c12ea6b38f)
|
@@ -68,6 +82,9 @@ I18N_BACKEND=pseudolocalization bundle exec rails server
|
|
68
82
|
* [Essential Guide to App Internationalization](https://drive.google.com/open?id=1c6nAw6ttF_uHRq0ZQaGu5gYD0vjq9lHP)
|
69
83
|
* [Pseudo Localization @ Netflix](https://medium.com/netflix-techblog/pseudo-localization-netflix-12fff76fbcbe)
|
70
84
|
|
71
|
-
##
|
85
|
+
## Contribute to this repo
|
72
86
|
|
73
87
|
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/pseudolocalization.
|
88
|
+
|
89
|
+
[gem]: https://badgen.net/rubygems/v/pseudolocalization?color=green
|
90
|
+
[gem_url]: https://rubygems.org/gems/pseudolocalization
|
data/dev.yml
CHANGED
data/lib/pseudolocalization.rb
CHANGED
@@ -5,9 +5,12 @@ module Pseudolocalization
|
|
5
5
|
module I18n
|
6
6
|
class Backend
|
7
7
|
attr_reader :original_backend
|
8
|
+
attr_accessor :ignores
|
8
9
|
|
9
10
|
def initialize(original_backend)
|
10
11
|
@original_backend = original_backend
|
12
|
+
@ignores = []
|
13
|
+
yield self if block_given?
|
11
14
|
end
|
12
15
|
|
13
16
|
def method_missing(name, *args, &block)
|
@@ -23,8 +26,51 @@ module Pseudolocalization
|
|
23
26
|
end
|
24
27
|
|
25
28
|
def translate(locale, key, options)
|
29
|
+
return original_backend.translate(locale, key, options) if key_ignored?(key)
|
30
|
+
|
26
31
|
::Pseudolocalization::I18n::Pseudolocalizer.pseudolocalize(original_backend.translate(locale, key, options))
|
27
32
|
end
|
33
|
+
|
34
|
+
def translations
|
35
|
+
original = original_backend.translations
|
36
|
+
original.transform_values do |locale_translations|
|
37
|
+
pseudolocalize_node(locale_translations)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def key_ignored?(key)
|
44
|
+
return false unless ignores
|
45
|
+
|
46
|
+
ignores.any? do |ignore|
|
47
|
+
case ignore
|
48
|
+
when Regexp
|
49
|
+
key.to_s.match(ignore)
|
50
|
+
when String
|
51
|
+
File.fnmatch(ignore, key.to_s)
|
52
|
+
else
|
53
|
+
Rails.logger.tagged('Pseudolocalization I18n').error('Ignore type unsupported. Expects an array of (mixed) Regexp or Strings.')
|
54
|
+
false
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def pseudolocalize_node(node, scope = [])
|
60
|
+
if node.is_a?(Hash)
|
61
|
+
node.each_with_object({}) do |(key, value), memo|
|
62
|
+
memo[key] = pseudolocalize_node(value, scope + [key])
|
63
|
+
end
|
64
|
+
elsif !key_ignored?(scope.join('.'))
|
65
|
+
::Pseudolocalization::I18n::Pseudolocalizer.pseudolocalize(node)
|
66
|
+
else
|
67
|
+
node
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def init_translations
|
72
|
+
original_backend.send(:init_translations)
|
73
|
+
end
|
28
74
|
end
|
29
75
|
end
|
30
76
|
end
|
data/pseudolocalization.gemspec
CHANGED
@@ -10,10 +10,16 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["christ.blais@gmail.com"]
|
11
11
|
spec.licenses = ['MIT']
|
12
12
|
|
13
|
+
spec.required_ruby_version = ">= 2.7"
|
14
|
+
|
13
15
|
spec.summary = %q{Internationalization development tool}
|
14
16
|
spec.description = %q{Internationalization development tool to help identify missing translations}
|
15
17
|
spec.homepage = "https://github.com/Shopify/pseudolocalization"
|
16
18
|
|
19
|
+
spec.metadata = {
|
20
|
+
'allowed_push_host' => 'https://rubygems.org'
|
21
|
+
}
|
22
|
+
|
17
23
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
24
|
f.match(%r{^(test|spec|features)/})
|
19
25
|
end
|
data/service.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pseudolocalization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Blais
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -45,10 +45,11 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- ".dependabot
|
49
|
-
- ".github/
|
48
|
+
- ".github/dependabot.yml"
|
49
|
+
- ".github/workflows/cla.yml"
|
50
50
|
- ".github/workflows/ruby-ci.yml"
|
51
51
|
- ".gitignore"
|
52
|
+
- ".ruby-version"
|
52
53
|
- CHANGELOG.md
|
53
54
|
- Gemfile
|
54
55
|
- Gemfile.lock
|
@@ -63,12 +64,13 @@ files:
|
|
63
64
|
- lib/pseudolocalization/version.rb
|
64
65
|
- pseudolocalization.gemspec
|
65
66
|
- service.yml
|
66
|
-
- shipit.yml
|
67
|
+
- shipit.rubygems.yml
|
67
68
|
homepage: https://github.com/Shopify/pseudolocalization
|
68
69
|
licenses:
|
69
70
|
- MIT
|
70
|
-
metadata:
|
71
|
-
|
71
|
+
metadata:
|
72
|
+
allowed_push_host: https://rubygems.org
|
73
|
+
post_install_message:
|
72
74
|
rdoc_options: []
|
73
75
|
require_paths:
|
74
76
|
- lib
|
@@ -76,15 +78,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
78
|
requirements:
|
77
79
|
- - ">="
|
78
80
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
81
|
+
version: '2.7'
|
80
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
83
|
requirements:
|
82
84
|
- - ">="
|
83
85
|
- !ruby/object:Gem::Version
|
84
86
|
version: '0'
|
85
87
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
87
|
-
signing_key:
|
88
|
+
rubygems_version: 3.5.13
|
89
|
+
signing_key:
|
88
90
|
specification_version: 4
|
89
91
|
summary: Internationalization development tool
|
90
92
|
test_files: []
|
data/.dependabot/config.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
version: 1
|
2
|
-
update_configs:
|
3
|
-
- package_manager: "ruby:bundler"
|
4
|
-
directory: "/"
|
5
|
-
update_schedule: "weekly"
|
6
|
-
automerged_updates:
|
7
|
-
- match:
|
8
|
-
dependency_type: "all"
|
9
|
-
update_type: "all"
|
10
|
-
version_requirement_updates: "auto"
|
11
|
-
default_reviewers:
|
12
|
-
- larouxn
|
13
|
-
- ChristianBlais
|
data/.github/probots.yml
DELETED