Skip to content
This repository was archived by the owner on May 19, 2022. It is now read-only.

keyPrefix should not be inherited by child components #75

@bodograumann

Description

@bodograumann

When I set the keyPrefix option for a component and include a different component inside, the keyPrefix of that child component will also be set to the value I choose for the parent component. I think that should not be the case.

import Child from 'Child.js'
export default {
	components: { Child },
	i18nOptions: { keyPrefix: "view.home" } },
	template: `<section><h1>{{ $t("title") }}</h1><Child /></section`
}

Child could be used in multiple places and every time it will have a different prefix set.

I don’t think this is a good approach, because it makes the translations really hard to control.

If you really want to support it, I would suggest allowing a function for the keyPrefix option, which takes the parent prefix and returns the childs’ prefix.

In any case, please default to having no prefix, if the keyPrefix option is not given in a component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions