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

Adding linked translations #50

Merged
merged 1 commit into from
Aug 28, 2016
Merged

Conversation

mochetts
Copy link
Contributor

This adds the enhancement requested on issue #26.

The idea is the same as Angular translate.
After the string has been translated with the current mechanism, it will replace each occurrence of a link translation (linked translations are preceded by "@:") and replace them by the corresponding translation.

So if you have the following locales:

en: {
    message: {
      the_world: 'the world',
      hoge: 'hoge',
      linked: 'Hello @:message.hoge!, isn\'t @:message.the_world great?'
    }
}

The result of executing $t('message.linked') will be Hello hoge!, isn't the world great?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 91.355% when pulling 21e5957 on mmochetti:linked-translations into e7c3d23 on kazupon:dev.

@kazupon
Copy link
Owner

kazupon commented Aug 28, 2016

awesome!! 💯
Thanks !!

@kazupon kazupon merged commit f7ae073 into kazupon:dev Aug 28, 2016
@mochetts mochetts deleted the linked-translations branch August 28, 2016 21:59
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.

3 participants