Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow splitting translations #52

Merged
merged 14 commits into from
Sep 24, 2024
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Nested translations don't change how you use translation keys, so nothing should
└── bot.ts
```

By splitting translations you don't change how you retrieve the keys contained within them, so for example, a key called `greeting` which is located in either the `locales/it.ftl` and `locales/en/dialogues/greeting.ftl` files can be retrieved by simply using `ctx.t("greeting")`.
EdJoPaTo marked this conversation as resolved.
Show resolved Hide resolved

Example bot
[not using sessions](https://grammy.dev/plugins/i18n.html#without-sessions):

Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export type LoadLocaleOptions = FilepathOrSource & {
bundleOptions?: FluentBundleOptions;
};

export type NestedTranslation = {
export interface NestedTranslation {
belongsTo: LocaleId;
translationSource: string;
};
}

export interface FluentOptions {
warningHandler?: WarningHandler;
Expand Down