storybookjs / vue-cli-plugin-storybook

Vue CLI plugin for Storybook
MIT License
279 stars 44 forks source link

How to get translations within <i18n> blocks to work? #96

Closed dnasir closed 4 years ago

dnasir commented 4 years ago

As the title suggests, I have my localisation texts located inside the components they are associated with. For example;

<i18n>
{
    "en": {
        "tripIdFilter": {
            "inputLabel": "Trip IDs"
        }
    },
    "nb": {
        "tripIdFilter": {
            "inputLabel": "Tur IDer"
        }
    }
}
</i18n>

When I load up Storybook, the translations don't show up. Instead I just get the key for the translation.

This works fine in the app.

pksunkara commented 4 years ago

Are you sure this is not an issue in Storybook?

dnasir commented 4 years ago

You're right. I assumed it was a compilation time thing, which is why I posted the issue here. The solution has been posted here: https://github.com/dlucian/vuejs-storybook-i18n/issues/1#issuecomment-587607439