pseudolocalization 0.9.1 → 0.10.0

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: 953fc8645d51046e0ea9f3cf943d07d297f0e69894aea97ae986ea3793949eff
4
- data.tar.gz: f2c5c2ff02cb1c8491794a0c48ccc7e045a95880d10a67b889e7a7ac1dd4592d
3
+ metadata.gz: '090ec80bbdb475a3a34314d973d911af6ae22121c50bb5bf9ca0fc9e9801df4c'
4
+ data.tar.gz: 6850bb50f3ccd2767ad8b5080c1616a7e82a7d5321d30568adb419efc1f06140
5
5
  SHA512:
6
- metadata.gz: 21a1bc280d86b3f1c666f48c69fee633e047eae3cfc662c2bcde713acc2554575749557e01dce83c5629605db15a252d724dc4dc2560b45409ce0b0bb73c830e
7
- data.tar.gz: f5324b187dc3c3113e486f90a89f9e1e2979286f732c5402fac5ac624e138eb2172bb4afa3a70d185912889a1c445deb6176af9fd4a8a39a0b4f9b67b66a0f07
6
+ metadata.gz: 319d0c9e1f9aa8ac9439312e1ddba612a7a9f403f989cb056b79a8d909103425be7bcaa89ed45d89368b1b692ea7ae706ca055f72a8081055f0211a3cd1784f1
7
+ data.tar.gz: 967d013f09fbe58c769b441e3bfcc43154d0fb94922e7ab2e8c46c50dc02a106a7ef3fb97bd1e280412778e1b7526d5b206da417172c3c381054027b6bf75d9b
@@ -10,5 +10,3 @@ updates:
10
10
  open-pull-requests-limit: 99
11
11
  reviewers:
12
12
  - Shopify/intl-languages
13
- registries:
14
- - rubygems-server-pkgs-shopify-io
@@ -6,26 +6,32 @@ on:
6
6
  - '**'
7
7
  push:
8
8
  branches:
9
- - master
9
+ - main
10
10
 
11
11
  jobs:
12
12
  build:
13
13
  name: Ruby ${{ matrix.version }} ${{ matrix.gemfile }}
14
- runs-on: ubuntu-latest
14
+ runs-on: ubuntu-24.04
15
15
  env:
16
16
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
17
17
  strategy:
18
+ # Report every Ruby independently. Without this, one failing job
19
+ # cancels its siblings and hides their results.
20
+ fail-fast: false
18
21
  matrix:
22
+ # Quoted on purpose. Unquoted, YAML reads 3.0 as the number 3 and
23
+ # setup-ruby then installs "latest 3.x" instead of Ruby 3.0.
19
24
  version:
20
- - 2.7
21
- - 3.0
22
- - 3.1
23
- - 3.2
24
- - 3.3
25
+ - '2.7'
26
+ - '3.0'
27
+ - '3.1'
28
+ - '3.2'
29
+ - '3.3'
30
+ - '3.4'
25
31
  gemfile:
26
32
  - Gemfile
27
33
  steps:
28
- - uses: actions/checkout@v2
34
+ - uses: actions/checkout@v7
29
35
 
30
36
  - name: Set up Ruby ${{ matrix.version }}
31
37
  uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ 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.10.0] - 2026-10-12
10
+ ### Fixed
11
+ - Fixed slow matching in `ESCAPED_REGEX` on strings with many unclosed `<`, `{{`, `%{` or `&` (CWE-1333). Lazy wildcards became character classes bounded by each token's own delimiters. Output is unchanged or improved for well-formed input; a token containing a nested opener of its own kind (`<b <i>x</i>`, `{{ a {b} }}`, `&a&amp;`) is no longer swallowed up to the first closer. Quoted HTML attribute values may now contain `<` and `>`.
12
+ - `ESCAPED_REGEX` now also preserves HTML comments (`<!-- -->`), Liquid tags (`{% %}`), markup spanning a newline, and `{`/`}` inside quoted Liquid strings; a `<` not followed by a letter, `/`, `!` or `?` is treated as text; a URL ends at `<` or `>`; only well-formed character references (`&name;`, `&#39;`, `&#x27;`) are kept. Output is unchanged for every string in Shopify Core's English locale files except 19 Liquid email subjects, where `{% if … %}` tags are now preserved instead of pseudolocalized.
13
+
9
14
  ## [0.9.1] - 2024-06-27
10
15
  ### Added
11
16
  - Added support for pseudolocalized translations [#82](https://github.com/Shopify/pseudolocalization/pull/82)
@@ -56,7 +61,8 @@ Nil.
56
61
 
57
62
  Please refer to [GitHub releases](https://github.com/Shopify/pseudolocalization/releases) for releases prior to [0.8.0].
58
63
 
59
- [Unreleased]: https://github.com/Shopify/pseudolocalization/compare/0.9.1...HEAD
64
+ [Unreleased]: https://github.com/Shopify/pseudolocalization/compare/v0.10.0...HEAD
65
+ [0.10.0]: https://github.com/Shopify/pseudolocalization/compare/v0.9.1...v0.10.0
60
66
  [0.9.1]: https://github.com/Shopify/pseudolocalization/compare/0.9.0...0.9.1
61
67
  [0.9.0]: https://github.com/Shopify/pseudolocalization/compare/0.8.4...0.9.0
62
68
  [0.8.4]: https://github.com/Shopify/pseudolocalization/compare/0.8.3...0.8.4
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pseudolocalization (0.9.1)
4
+ pseudolocalization (0.10.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- minitest (5.14.4)
10
- rake (13.0.3)
9
+ minitest (5.25.4)
10
+ rake (13.2.1)
11
11
 
12
12
  PLATFORMS
13
13
  ruby
@@ -18,4 +18,4 @@ DEPENDENCIES
18
18
  rake (~> 13.0)
19
19
 
20
20
  BUNDLED WITH
21
- 2.2.22
21
+ 2.4.22
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pseudolocalization
2
2
 
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)
3
+ [![Version][gem]][gem_url] [![Build Status](https://github.com/Shopify/pseudolocalization/workflows/CI/badge.svg?branch=main)](https://github.com/Shopify/pseudolocalization/actions?query=workflow%3ACI)
4
4
 
5
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)
6
6
 
@@ -9,7 +9,7 @@
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
 
12
- As an example, let's examine the string "Set the power switch to 0.";
12
+ As an example, let's examine the string "Set the power switch to 0.":
13
13
 
14
14
  | Language | String | Characters | Percentage |
15
15
  |----------|--------|------------|------------|
@@ -25,6 +25,12 @@ 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
+ For the example above, this looks like:
29
+
30
+ | Language | String | Characters | Percentage |
31
+ |----------|--------|------------|------------|
32
+ | Pseudo-English | Ṣḛḛṭ ṭḥḛḛ ṗṓṓẁḛḛṛ ṡẁḭḭṭͼḥ ṭṓṓ 0. | 32 chars | 23% more
33
+
28
34
  ## How to use this repo
29
35
  ### Installation
30
36
 
@@ -3,11 +3,13 @@ module Pseudolocalization
3
3
  class Pseudolocalizer
4
4
  ESCAPED_REGEX = Regexp.new("(#{
5
5
  [
6
- "<.*?>",
7
- "{{.*?}}",
8
- "%{.*?}",
9
- "https?:\/\/\\S+",
10
- "&\\S*?;"
6
+ "<!--(?:[^-]|-[^-])*-->", # HTML comment
7
+ "<[a-zA-Z/!?][^<>\"']*(?:(?:\"[^\"]*\"|'[^']*')[^<>\"']*)*>", # HTML tag, end tag, doctype
8
+ "{{[^{}\"']*(?:(?:\"[^\"]*\"|'[^']*')[^{}\"']*)*}}", # Liquid output
9
+ "{%-?\\s*[a-zA-Z#][^%\"']*(?:(?:\"[^\"]*\"|'[^']*')[^%\"']*)*%}", # Liquid tag
10
+ "%{[^{}\\n]*}", # Ruby I18n interpolation
11
+ "https?:\/\/[^\\s<>]+", # URL
12
+ "&(?:[a-zA-Z][a-zA-Z0-9]*|#[0-9]+|#[xX][0-9a-fA-F]+);", # HTML character reference
11
13
  ].join('|')
12
14
  })")
13
15
 
@@ -1,3 +1,3 @@
1
1
  module Pseudolocalization
2
- VERSION = "0.9.1"
2
+ VERSION = "0.10.0"
3
3
  end
data/shipit.rubygems.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  ci:
2
2
  require:
3
- - 'Ruby 2.4 Gemfile'
4
- - 'Ruby 2.5 Gemfile'
5
- - 'Ruby 2.6 Gemfile'
6
3
  - 'Ruby 2.7 Gemfile'
7
- - 'Ruby 3 Gemfile'
4
+ - 'Ruby 3.0 Gemfile'
5
+ - 'Ruby 3.1 Gemfile'
6
+ - 'Ruby 3.2 Gemfile'
7
+ - 'Ruby 3.3 Gemfile'
8
+ - 'Ruby 3.4 Gemfile'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pseudolocalization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Blais
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -70,7 +69,6 @@ licenses:
70
69
  - MIT
71
70
  metadata:
72
71
  allowed_push_host: https://rubygems.org
73
- post_install_message:
74
72
  rdoc_options: []
75
73
  require_paths:
76
74
  - lib
@@ -85,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
83
  - !ruby/object:Gem::Version
86
84
  version: '0'
87
85
  requirements: []
88
- rubygems_version: 3.5.13
89
- signing_key:
86
+ rubygems_version: 4.0.21
90
87
  specification_version: 4
91
88
  summary: Internationalization development tool
92
89
  test_files: []