aurelia/i18n

How to translate params via code (ViewModel)?

ghiscoding opened this issue · 5 comments

I'm submitting a bug report
I'm submitting a feature request

  • Library Version:
    2.1.0

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    9.2.0

  • NPM Version:
    5.5.1
  • JSPM OR Webpack AND Version
    WebPack
  • Browser:
    all

  • Language:
    all

Current behavior:
There is no information in the doc about translating with params via code (ViewModel), is that even possible?

Expected/desired behavior:
Update doc to show how to translate via code (ViewModel)

if you take a look at the docs and search for Translating via code, the section explains that the second parameter to tr accepts an option param which may contain the replacement parts as used with t-params . Looking at Complex objects for variables you'll see an example of how additional parameters may be provided.

Do you think this is enough? If you have a better idea I'd like to ask you to create a PR on this file the way you see it fit.

Wow I did not see that, my bad, I was looking around via code and t-params and couldn't find the info. Also there's a bad link, which may have helped if it existed. The link in the next section is not working and I don't know what it could be, is it suppose to refer to the Complex object for variables?

The object passed to t-params is a complex object explained in the next section

I think this

Complex objects for variables

Should be renamed to this

Complex objects for variables via code

Also, this

The object passed to t-params is a complex object explained in the next section

Could be changed to this (unless next section already point to the same link? don't know since it's a broken link)

The object passed to t-params is a complex object explained in the next section. To use it via code, see Complex objects for variables via code

I think that sounds good. If you could create a PR with those Changes that would be awesome. Regarding the links, i think there's a issue that you cant link to 3rd level anchors, so id recommend just leaving them out and describing where to find what instead.

done

awesome, thanks for the help