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:
@@ -36,15 +36,66 @@
|
||||
<div id="currentDutyView" class="current-duty-view hidden"></div>
|
||||
</div>
|
||||
<script src="https://telegram.org/js/telegram-web-app.js"></script>
|
||||
<script>
|
||||
if (window.Telegram && window.Telegram.WebApp && window.Telegram.WebApp.ready) {
|
||||
window.Telegram.WebApp.ready();
|
||||
}
|
||||
</script>
|
||||
<script src="/app/config.js"></script>
|
||||
<script type="importmap">
|
||||
{
|
||||
"scopes": {
|
||||
"./js/": {
|
||||
"./js/i18n.js": "./js/i18n.js?v=1"
|
||||
"./js/api.js": "./js/api.js?v=3",
|
||||
"./js/auth.js": "./js/auth.js?v=3",
|
||||
"./js/calendar.js": "./js/calendar.js?v=2",
|
||||
"./js/constants.js": "./js/constants.js?v=2",
|
||||
"./js/contactHtml.js": "./js/contactHtml.js?v=2",
|
||||
"./js/currentDuty.js": "./js/currentDuty.js?v=2",
|
||||
"./js/dateUtils.js": "./js/dateUtils.js?v=2",
|
||||
"./js/dayDetail.js": "./js/dayDetail.js?v=2",
|
||||
"./js/dom.js": "./js/dom.js?v=3",
|
||||
"./js/dutyList.js": "./js/dutyList.js?v=2",
|
||||
"./js/hints.js": "./js/hints.js?v=2",
|
||||
"./js/i18n.js": "./js/i18n.js?v=3",
|
||||
"./js/theme.js": "./js/theme.js?v=2",
|
||||
"./js/ui.js": "./js/ui.js?v=2",
|
||||
"./js/utils.js": "./js/utils.js?v=2"
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script type="module" src="js/main.js?v=4"></script>
|
||||
<script type="module" src="js/main.js?v=5" id="main-module"></script>
|
||||
<script>
|
||||
(function() {
|
||||
var loadTimeout = 10000;
|
||||
var mainScript = document.getElementById("main-module");
|
||||
if (mainScript) {
|
||||
mainScript.addEventListener("error", function() {
|
||||
var loading = document.getElementById("loading");
|
||||
if (loading && !loading.classList.contains("hidden")) {
|
||||
loading.classList.add("hidden");
|
||||
var err = document.getElementById("error");
|
||||
if (err) {
|
||||
err.hidden = false;
|
||||
err.textContent = "Failed to load app. Check connection and try again.";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
setTimeout(function() {
|
||||
if (window.__dtReady) return;
|
||||
var loading = document.getElementById("loading");
|
||||
if (loading && !loading.classList.contains("hidden")) {
|
||||
loading.classList.add("hidden");
|
||||
var err = document.getElementById("error");
|
||||
if (err) {
|
||||
err.hidden = false;
|
||||
err.textContent = "App is taking too long to load. Check your connection and refresh.";
|
||||
}
|
||||
}
|
||||
}, loadTimeout);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user