Skip to content

[Feature request] Automatically prepend all paths in navbar and sidebar with root path of locale #124

@lifehackerhansol

Description

@lifehackerhansol

Clear and concise description of the problem

As per #110, all paths in the theme configuration must be hardcoded. This makes it slightly difficult to manage several translated locales as all of them must be manually handled by the end user.

Suggested solution

Since the i18n page on VuePress and default theme locale documentation both suggest that a static path has to be passed anyway, I feel that it would make sense if the configurations themselves do not need to have the locale path hardcoded for navbar and sidebar, and be automatically prepended, reducing complexity on the user side.

For instance, if a user defines:

    sidebar: {
        '/get-started.html': [
            ...

then it can be interpreted as /zh_CN/get-started.html.

Alternative

At the moment, it is also impossible to use a variable for items in sidebar for some reason, i.e. this isn't possible and throws some error:

const locale = 'zh_CN';
sidebar: {
    `/${locale}/get-started.html`: [
        ...

It would be nice if this was supported, as it would be easier to enable languages by just changing $locale somewhere.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions