Skip to content

Scoped Message Loading in Vue I18n #2249

@kefahB

Description

@kefahB

Clear and concise description of the problem

With nested locale files, developers must redundantly write prefixes such as t('homePage.title'), t('homePage.welcome'), etc., inside the HomePage component.

Suggested solution

Add a scope option to useI18n so developers can load a subset of the JSON and avoid redundancy:

const { t } = useI18n({ scope: 'homePage' });
t('title');    // resolves to homePage.title
t('welcome');  // resolves to homePage.welcome

Benefit
Removes repetitive key prefixes, making code cleaner and easier to maintain.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions