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

support placeholders similar to Chrome.i18n APIs #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kvsrohit
Copy link

Hi Eric,
I've redone benjaminpg's changes on latest clone with minor changes and slight variation on demo and test cases.
You may want to checkout.

Cheers//rohit

@kvsrohit
Copy link
Author

Placeholders

It's possible to insert text within the message which requires no translation (e.g: names, dates, numbers).
To make available the use of placeholders the message must contain placeholders in Chrome.i18n format ($name$) whenever a parameter
should be used, and to use these add the attribute "placeholders" having value array. Example:

"error": {
    "message": "Error: $details$",
    "description": "Generic error template. Expects error parameter to be passed in.",
    "placeholders": {
        "details": {
            "content": "$1",
            "example": "Failed to fetch RSS feed."
        }
   }
}


<i18-msg msgid="error" placeholders='["Failed to fetch data."]'></i18n-msg>

It's also possible to use {{}} and [[]] within the placeholders.

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.

1 participant