Skip to content

fallback to default locale #42

@torvalde

Description

@torvalde

When in production mode and a key does not exist in the current language, the key is displayed. We have some keys that are generated so we want to avoid showing them to the customer even if a translation in the current language is not available, instead we would like to show the translation in the default language.

Would it be ok to first check the translation in the default locale before returning the key?

Something like:

    if (!this.locales[locale][singular]) {
        if (this.devMode) {
            this.locales[locale][singular] = plural ? { one: singular, other: plural } : singular;
            this.writeFile(locale);
        } else {
            locale = this.defaultLocale;
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions