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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7bcc4fee756deba3c77c8c816ef2149b675b1135c61f21c4d41e754dbd72c52
4
- data.tar.gz: 89a2a43c030b76e63f8375ed81a16d32d60746c27bc5e0fd324cc6ba343df0f8
3
+ metadata.gz: ca597fc6e2ea40f05915ef289dc48d3deb1c95872aec4a8b69474caeabfc8b39
4
+ data.tar.gz: 7485fd957362b90aeedd711c4197c96b8629d641896fa65e77f016a613a486b6
5
5
  SHA512:
6
- metadata.gz: 19e144f8851d3be73ae5adea066debfce38035e7610d6cd1993ed59c99f83dcef80c5f601b427d1089746ce89e8ce0280ef2f9e0a59baf51983d42a78e90e8df
7
- data.tar.gz: 6831bf06bb73be3911670220c8ff0330cda9e8aa4b9da694fc7b2cdf05e2ee269d5772a695df6607e81f10171cf95c46e000825d7ae1107bf3a052ffaada5463
6
+ metadata.gz: 6d238815d07f095314e6fbbca25a71ea44543e8a8d57a1b4c3fc2f7d55a5e76b56d75cd7a8f308ed89757ee3710fd4e5e0dcfd4d5ce3968ca065535a4e01a824
7
+ data.tar.gz: 35e98480b647dc3203e2c09248db82dd060d08d77032c410cfc76492eaa4775e214a07fe9582429a57025a1da7e641bde3cb95cf4ef9f9029777abd61fb350bf
@@ -9,5 +9,4 @@ update_configs:
9
9
  update_type: "all"
10
10
  version_requirement_updates: "auto"
11
11
  default_reviewers:
12
- - larouxn
13
- - ChristianBlais
12
+ - Shopify/intl-languages
@@ -1,7 +1,12 @@
1
1
  name: CI
2
2
 
3
3
  on:
4
- - push
4
+ pull_request:
5
+ branches:
6
+ - '**'
7
+ push:
8
+ branches:
9
+ - master
5
10
 
6
11
  jobs:
7
12
  build:
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.8.4...HEAD
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
@@ -1,10 +1,4 @@
1
- ruby '>= 2.4'
2
-
3
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
4
2
 
5
3
  # Specify your gem's dependencies in pseudolocalization.gemspec
6
4
  gemspec
7
-
8
- group :deployment do
9
- gem 'package_cloud'
10
- end
data/Gemfile.lock CHANGED
@@ -1,53 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pseudolocalization (0.8.4)
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 [![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)
1
+ # Pseudolocalization
2
2
 
3
- [gem]: https://badge.fury.io/rb/pseudolocalization.svg
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
- > Pseudolocalization (or pseudo-localization) is a software testing method used for testing internationalization aspects of software. Instead of translating the text of the software into a foreign language, as in the process of localization, the textual elements of an application are replaced with an altered version of the original language.
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
- ## Why?
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
- ## Installation
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
- ## Usage
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
- ## Other Resources
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
- ## Contributing
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Pseudolocalization
2
- VERSION = "0.8.4"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -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: International Growth
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
- - intl-dev
5
+ - help-i18n-and-translation
8
6
  classification: library
9
7
  ci_url: https://github.com/Shopify/pseudolocalization/workflows/CI
@@ -5,7 +5,3 @@ ci:
5
5
  - 'Ruby 2.6 Gemfile'
6
6
  - 'Ruby 2.7 Gemfile'
7
7
  - 'Ruby 3 Gemfile'
8
- deploy:
9
- override:
10
- - bundle exec rake build
11
- - bundle exec package_cloud push shopify/gems pkg/*.gem
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.8.4
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-01-15 00:00:00.000000000 Z
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
- post_install_message:
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.2.5
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: []