Skip to content

support placeholders similar to Chrome.i18n APIs#39

Open
kvsrohit wants to merge 2 commits intoebidel:masterfrom
kvsrohit:master
Open

support placeholders similar to Chrome.i18n APIs#39
kvsrohit wants to merge 2 commits intoebidel:masterfrom
kvsrohit:master

Conversation

@kvsrohit
Copy link
Copy Markdown

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
Copy Markdown
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