i18n-node icon indicating copy to clipboard operation
i18n-node copied to clipboard

I can't handle nested translations without sprintf

Open LucianoGanga opened this issue 8 years ago • 2 comments

Hi! I'm trying to get the translation for the copyright key in this nested object:


    "app": {
        "name": "Administration tool",
        "companyName": "Sirena",
        "description": "Get access to all the administrative tools",
        "copyright": "{{app.companyName}} © {{year}}"
    },

The problem that I have is that I don't know how to get the copyright translation with the app.companyName translated (something like what this other module does: http://i18next.com/translate/nesting/)

Is there a way to do that with i18n-node?

Thanks!

LucianoGanga avatar Jun 02 '16 17:06 LucianoGanga

nested backreferences are not supported out-of-the-box. But you might implement that with a little effort by using https://github.com/mashpie/i18n-node#i18ngetcatalog to fetch all translations combined with mustache or sprintf (https://github.com/mashpie/i18n-node#mustache-support).

mashpie avatar Jun 03 '16 12:06 mashpie

I am sorry to hear that...

chshouyu avatar Jan 04 '17 09:01 chshouyu