Skip to content

[Feature request] Option to default to a given language for fbs() calls #61

Description

@bk-tho

Similar to the i18next equivalent, see: https://www.i18next.com/overview/api#getfixedt

Returns a t function that defaults to given language or namespace.

Possibly implemented as

type FbtAPIT<Output, ParamInput, ParamOutput> = {
  (text: string | ReadonlyArray<string>, description: string, options?: {
    author?: string;
    project?: string;
    subject: IntlVariations;
    locale?: string; // sets a fixed locale
  }): Output;
  // ...
}

or alternatively fbs.fixed(locale: string, /* ... */) or similar.

I'm sure there are plenty of different use cases but this is ours:
A typical workflow for users of our mobile app is to fill out a technical report that needs to be reviewed and accepted by someone else on the same device. The user may have set any arbitrary language. The one reviewing the report may not speak that language, so during handoff, we want the relevant parts of the review screens to always be in English. Crucially, we want the surrounding UI elements that are not strictly part of the report to continue using the user's language.

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