Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for TranslatedString to close #136 #147

Merged
merged 2 commits into from May 20, 2017
Merged

Conversation

raxoft
Copy link
Contributor

@raxoft raxoft commented May 17, 2017

The subject says it all, this is the fix for issues discussed in #136.

The solution drops the @value idea and uses self as the authoritative value again instead, but the trick was to use super instead of self in #to_s to make it all work correctly with String.new, ActiveRecord's StringBuffer, etc.

Tested against 2.1.10, 2.2.3, 2.3.4 and 2.4.1.

BTW, note that I kept the changes at the minimum, so Untranslated#to_s still returns TranslatedString, not String, as it always did before. I am not sure if this was intentional or not. If you want to change this, simply adding .to_s on the @filter.process result in Untranslated#to_s would do the trick.

…s returns String.

Before this fix, calling for example TranslatedString#split would create TranslatedStrings whose #to_s method would return nil.
@ai
Copy link
Member

ai commented May 18, 2017

Great. Sorry, I am on conference. I will look in weekend.

@ai ai merged commit 5268bc8 into r18n:master May 20, 2017
@raxoft raxoft deleted the fix-translated-string branch March 16, 2018 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants