-
-
Notifications
You must be signed in to change notification settings - Fork 417
Comparing changes
Open a pull request
base repository: ruby-i18n/i18n
base: v1.14.5
head repository: ruby-i18n/i18n
compare: v1.14.6
- 12 commits
- 12 files changed
- 6 contributors
Commits on Jul 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 869460a - Browse repository at this point
Copy the full SHA 869460aView commit details
Commits on Jul 25, 2024
-
Optimize pluralization logic in test data
- Switch from Array#include? to Range#cover? for more than 5 items
Configuration menu - View commit details
-
Copy full SHA for 51e205a - Browse repository at this point
Copy the full SHA 51e205aView commit details
Commits on Aug 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 55dc807 - Browse repository at this point
Copy the full SHA 55dc807View commit details -
Merge pull request #698 from davetron5000/rdoc-fixes
fix issues with RDoc generation
Configuration menu - View commit details
-
Copy full SHA for eacc34f - Browse repository at this point
Copy the full SHA eacc34fView commit details
Commits on Aug 23, 2024
-
Fixes strings being interpolated multiple times
Similarly to #599, I've observed issues issues where untrusted user input that includes interpolation patterns gets unintentionally interpolated and leads to bogus `I18n::MissingInterpolationArgument` exceptions. This happens when multiple lookups are required for a key to be resolved, which is common when resolving defaults, or resolving a key that itself resolves to a Symbol. As an example let's consider these translations, common for Rails apps: ```yaml en: activerecord: errors: messages: taken: "%{value} has already been taken" ``` If the `value` given to interpolate ends up containing interpolation characters, and Rails specifies default keys (as [described here](https://guides.rubyonrails.org/i18n.html#error-message-scopes)), resolving those defaults will cause a `I18n::MissingInterpolationArgument` to be raised: ```rb I18n.t('activerecord.errors.models.organization.attributes.name.taken', value: '%{dont_interpolate_me}', default: [ :"activerecord.errors.models.organization.taken", :"activerecord.errors.messages.taken" ] ) ``` Raises: ``` I18n::MissingInterpolationArgument: missing interpolation argument :dont_interpolate_me in "%{dont_interpolate_me}" ({:value=>"%{dont_interpolate_me}"} given) ``` Instead of this, we'd expect the translation to resolve to: ``` %{dont_interpolate_me} has already been taken ``` This behaviour is caused by the way that recursive lookups work: whenever a key can't be resolved to a string directly, the `I18n.translate` method is called either to walk through the defaults specified, or if a Symbol is matched, to try to resolve that symbol. This results in interpolation being executed twice for recursive lookups... once on the pass that finally resolves to a string, and again on the original call to `I18n.translate`. A "proper" fix here would likely revolve around decoupling key resolution from interpolation... it feels odd to me that the `resolve_entry` method calls `I18n.translate`... however I see this as a fundamental change beyond the scope of this fix. Instead I'm proposing to add a new reserved key `skip_interpolation` that gets passed down into every recursive call of `I18n.translate` and instructs the method to skip interpolation. This ensures that only the initial `I18n.translate` call is the one that gets its string interpolated.
Configuration menu - View commit details
-
Copy full SHA for 229d57e - Browse repository at this point
Copy the full SHA 229d57eView commit details
Commits on Sep 3, 2024
-
Configuration menu - View commit details
-
Copy full SHA for ee22f10 - Browse repository at this point
Copy the full SHA ee22f10View commit details
Commits on Sep 15, 2024
-
Merge pull request #701 from stevegeek/fix_load_rb_with_pathname
Fix loading of .rb locale files when `load_path` is not a string
Configuration menu - View commit details
-
Copy full SHA for d718ed4 - Browse repository at this point
Copy the full SHA d718ed4View commit details -
Merge pull request #699 from alexpls/master
Fixes strings being interpolated multiple times
Configuration menu - View commit details
-
Copy full SHA for aacb76a - Browse repository at this point
Copy the full SHA aacb76aView commit details -
Merge pull request #697 from zachmargolis/margolis-optimize-plurals
Optimize pluralization logic in test data
Configuration menu - View commit details
-
Copy full SHA for 18799df - Browse repository at this point
Copy the full SHA 18799dfView commit details -
Merge pull request #696 from KinWang-2013/fix/exists-method-nil-key
[FIX] Raise ArgumentError on nil key in exists?
Configuration menu - View commit details
-
Copy full SHA for 1fbc930 - Browse repository at this point
Copy the full SHA 1fbc930View commit details -
2
Configuration menu - View commit details
-
Copy full SHA for 6d0c2ce - Browse repository at this point
Copy the full SHA 6d0c2ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3b65f65 - Browse repository at this point
Copy the full SHA 3b65f65View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v1.14.5...v1.14.6