i18n-keyless-core 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types.d.ts +21 -2
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -142,17 +142,36 @@ interface TranslationStoreState {
|
|
|
142
142
|
_hasHydrated: boolean;
|
|
143
143
|
storage: I18nConfig["storage"] | null;
|
|
144
144
|
}
|
|
145
|
+
type TranslationOptions = {
|
|
146
|
+
/**
|
|
147
|
+
* the context of the translation
|
|
148
|
+
* useful for ambiguous translations, like "8 heures" in French could be "8 AM" or "8 hours"
|
|
149
|
+
* You'll find it useful when it occurs to you, don't worry :)
|
|
150
|
+
*/
|
|
151
|
+
context?: string;
|
|
152
|
+
/**
|
|
153
|
+
* could be helpful if something weird happens with this particular key
|
|
154
|
+
*/
|
|
155
|
+
debug?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* if the proposed translation from AI is not satisfactory,
|
|
158
|
+
* you can use this field to setup your own translation.
|
|
159
|
+
* You can leave it there forever, or remove it once your translation is saved
|
|
160
|
+
*/
|
|
161
|
+
forceTemporary?: Record<Lang, string>;
|
|
162
|
+
};
|
|
145
163
|
interface TranslationStoreActions {
|
|
146
164
|
_hydrate: () => Promise<void>;
|
|
147
|
-
getTranslation: (text: string,
|
|
165
|
+
getTranslation: (text: string, options?: TranslationOptions) => string | undefined;
|
|
148
166
|
setTranslations: (translations: Translations) => void;
|
|
149
|
-
translateKey: (key: string,
|
|
167
|
+
translateKey: (key: string, options?: TranslationOptions) => void;
|
|
150
168
|
setLanguage: (lang: Lang) => void;
|
|
151
169
|
}
|
|
152
170
|
export type TranslationStore = TranslationStoreState & TranslationStoreActions;
|
|
153
171
|
export interface I18nKeylessRequestBody {
|
|
154
172
|
key: string;
|
|
155
173
|
context?: string;
|
|
174
|
+
forceTemporary?: TranslationOptions["forceTemporary"];
|
|
156
175
|
languages: I18nConfig["languages"]["supported"];
|
|
157
176
|
primaryLanguage: I18nConfig["languages"]["primary"];
|
|
158
177
|
}
|