pseudolocalization 0.8.4 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dependabot/config.yml +1 -2
- data/.github/workflows/ruby-ci.yml +6 -1
- data/CHANGELOG.md +6 -1
- data/Gemfile +1 -7
- data/Gemfile.lock +1 -33
- data/README.md +26 -9
- data/lib/pseudolocalization.rb +23 -0
- data/lib/pseudolocalization/version.rb +1 -1
- data/pseudolocalization.gemspec +4 -0
- data/service.yml +3 -5
- data/{shipit.yml → shipit.rubygems.yml} +0 -4
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca597fc6e2ea40f05915ef289dc48d3deb1c95872aec4a8b69474caeabfc8b39
|
4
|
+
data.tar.gz: 7485fd957362b90aeedd711c4197c96b8629d641896fa65e77f016a613a486b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d238815d07f095314e6fbbca25a71ea44543e8a8d57a1b4c3fc2f7d55a5e76b56d75cd7a8f308ed89757ee3710fd4e5e0dcfd4d5ce3968ca065535a4e01a824
|
7
|
+
data.tar.gz: 35e98480b647dc3203e2c09248db82dd060d08d77032c410cfc76492eaa4775e214a07fe9582429a57025a1da7e641bde3cb95cf4ef9f9029777abd61fb350bf
|
data/.dependabot/config.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ 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.0] - 2021-02-17
|
10
|
+
### Added
|
11
|
+
- Added support for ignoring specific translation keys [#59](https://github.com/Shopify/pseudolocalization/pull/59)
|
12
|
+
|
9
13
|
## [0.8.4] - 2021-01-15
|
10
14
|
### Added
|
11
15
|
- Added support for Ruby 3. [#53](https://github.com/Shopify/pseudolocalization/pull/53)
|
@@ -48,7 +52,8 @@ Nil.
|
|
48
52
|
|
49
53
|
Please refer to [GitHub releases](https://github.com/Shopify/pseudolocalization/releases) for releases prior to [0.8.0].
|
50
54
|
|
51
|
-
[Unreleased]: https://github.com/Shopify/pseudolocalization/compare/0.
|
55
|
+
[Unreleased]: https://github.com/Shopify/pseudolocalization/compare/0.9.0...HEAD
|
56
|
+
[0.9.0]: https://github.com/Shopify/pseudolocalization/compare/0.8.4...0.9.0
|
52
57
|
[0.8.4]: https://github.com/Shopify/pseudolocalization/compare/0.8.3...0.8.4
|
53
58
|
[0.8.3]: https://github.com/Shopify/pseudolocalization/compare/0.8.2...0.8.3
|
54
59
|
[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.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
domain_name (0.5.20190701)
|
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
9
|
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
|
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
21
|
2.2.4
|
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] [![Build Status](https://github.com/Shopify/pseudolocalization/workflows/CI/badge.svg?branch=master)](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/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,28 @@ 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
|
+
private
|
35
|
+
|
36
|
+
def key_ignored?(key)
|
37
|
+
return false unless ignores
|
38
|
+
|
39
|
+
ignores.any? do |ignore|
|
40
|
+
case ignore
|
41
|
+
when Regexp
|
42
|
+
key.to_s.match(ignore)
|
43
|
+
when String
|
44
|
+
File.fnmatch(ignore, key.to_s)
|
45
|
+
else
|
46
|
+
Rails.logger.tagged('Pseudolocalization I18n').error('Ignore type unsupported. Expects an array of (mixed) Regexp or Strings.')
|
47
|
+
false
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
28
51
|
end
|
29
52
|
end
|
30
53
|
end
|
data/pseudolocalization.gemspec
CHANGED
@@ -14,6 +14,10 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.description = %q{Internationalization development tool to help identify missing translations}
|
15
15
|
spec.homepage = "https://github.com/Shopify/pseudolocalization"
|
16
16
|
|
17
|
+
spec.metadata = {
|
18
|
+
'allowed_push_host' => 'https://rubygems.org'
|
19
|
+
}
|
20
|
+
|
17
21
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
22
|
f.match(%r{^(test|spec|features)/})
|
19
23
|
end
|
data/service.yml
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
org_line:
|
2
|
-
director: christianblais
|
1
|
+
org_line: Build
|
3
2
|
owners:
|
4
|
-
- Shopify/intl-languages
|
5
|
-
- Shopify/intl-eng
|
3
|
+
- Shopify/intl-languages
|
6
4
|
slack_channels:
|
7
|
-
-
|
5
|
+
- help-i18n-and-translation
|
8
6
|
classification: library
|
9
7
|
ci_url: https://github.com/Shopify/pseudolocalization/workflows/CI
|
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.0
|
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: 2021-
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -63,12 +63,13 @@ files:
|
|
63
63
|
- lib/pseudolocalization/version.rb
|
64
64
|
- pseudolocalization.gemspec
|
65
65
|
- service.yml
|
66
|
-
- shipit.yml
|
66
|
+
- shipit.rubygems.yml
|
67
67
|
homepage: https://github.com/Shopify/pseudolocalization
|
68
68
|
licenses:
|
69
69
|
- MIT
|
70
|
-
metadata:
|
71
|
-
|
70
|
+
metadata:
|
71
|
+
allowed_push_host: https://rubygems.org
|
72
|
+
post_install_message:
|
72
73
|
rdoc_options: []
|
73
74
|
require_paths:
|
74
75
|
- lib
|
@@ -83,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
84
|
- !ruby/object:Gem::Version
|
84
85
|
version: '0'
|
85
86
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
87
|
-
signing_key:
|
87
|
+
rubygems_version: 3.0.3
|
88
|
+
signing_key:
|
88
89
|
specification_version: 4
|
89
90
|
summary: Internationalization development tool
|
90
91
|
test_files: []
|