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

add fix to skip ' with trailing slash #154

Merged
merged 1 commit into from Jul 27, 2017
Merged

add fix to skip ' with trailing slash #154

merged 1 commit into from Jul 27, 2017

Conversation

AleksSem
Copy link

add fix to skip ' with trailing slash in translation for example {i18n.__('You don't have any bookmark.')}

@mlocati
Copy link
Member

mlocati commented Jul 26, 2017

What if we have an even number of \ before '?

@AleksSem
Copy link
Author

AleksSem commented Jul 26, 2017

I don`t check that issue with multiple \ but without that fix ill get

You don'thaveanybookmark.')}

{i18n.__('Youcanadda .....................

instead

You don't have any bookmark.

in my translations

Copy link
Member

@oscarotero oscarotero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. It looks fine but in my opinion, there's a better way to handle this:
Capture the first \ character, move one position and save the next character. This fixes all possible cases (like \\ or \'\\, etc). It should be applied for double quotes too.

@AleksSem
Copy link
Author

Yes you definitely right, your solution i better.

@AleksSem
Copy link
Author

AleksSem commented Jul 27, 2017

Should work now
Checked on on cases :

{i18n.__('You don\'t have any bookmark.')}
{i18n.__('You don\\\'t have any bookmark.')}
{i18n.__('You don\\\\\\\\\'t have any bookmark.')}
{i18n.__('You don\\\\\\\\\"t have any bookmark.')}

@oscarotero oscarotero merged commit 6c27656 into php-gettext:master Jul 27, 2017
@oscarotero
Copy link
Member

Thanks 👍

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

3 participants