feat: unify language handling across the application
- Updated the language configuration to use a single source of truth from `DEFAULT_LANGUAGE` for the bot, API, and Mini App, eliminating auto-detection from user settings. - Refactored the `get_lang` function to always return `DEFAULT_LANGUAGE`, ensuring consistent language usage throughout the application. - Modified the handling of language in various components, including API responses and UI elements, to reflect the new language management approach. - Enhanced documentation and comments to clarify the changes in language handling. - Added unit tests to verify the new language handling behavior and ensure coverage for the updated functionality.
This commit is contained in:
@@ -66,6 +66,28 @@ describe("getInitData", () => {
|
||||
window.location = { ...origLocation, hash: "", search: "" };
|
||||
expect(getInitData()).toBe("");
|
||||
});
|
||||
|
||||
it("returns data from hash query param without double-decoding", () => {
|
||||
window.Telegram = { WebApp: { initData: "" } };
|
||||
delete window.location;
|
||||
window.location = {
|
||||
...origLocation,
|
||||
hash: "#tgWebAppVersion=6&tgWebAppData=user%3Dname%26hash%3Dabc",
|
||||
search: "",
|
||||
};
|
||||
expect(getInitData()).toBe("user=name&hash=abc");
|
||||
});
|
||||
|
||||
it("returns data from search query param without double-decoding", () => {
|
||||
window.Telegram = { WebApp: { initData: "" } };
|
||||
delete window.location;
|
||||
window.location = {
|
||||
...origLocation,
|
||||
hash: "",
|
||||
search: "?tgWebAppData=user%3Dname%26hash%3Dabc",
|
||||
};
|
||||
expect(getInitData()).toBe("user=name&hash=abc");
|
||||
});
|
||||
});
|
||||
|
||||
describe("isLocalhost", () => {
|
||||
|
||||
Reference in New Issue
Block a user