Skip to content

Commit 7144b0a

Browse files
committed
Maintain translation between pages
1 parent 4bceeaf commit 7144b0a

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The project separates the processing logic (backend) from the user interface (fr
9595
LogicPaper/
9696
├── app/
9797
│ ├── core/
98-
│ │ ├── engine.py # Document Processing (Docx/Pptx/Pdf)
98+
│ │ ├── engine.py # Document Processing (docx/pptx/pdf)
9999
│ │ ├── formatter.py # Filter Dispatcher
100100
│ │ ├── validator.py # Template Checker
101101
│ │ └── strategies/ # Formatting Logic Modules

README_pt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ O projeto separa a lógica de processamento (backend) da interface do usuário (
9595
LogicPaper/
9696
├── app/
9797
│ ├── core/
98-
│ │ ├── engine.py # Processamento de Documentos (Docx/Pptx/Pdf)
98+
│ │ ├── engine.py # Processamento de Documentos (docx/pptx/pdf)
9999
│ │ ├── formatter.py # Despachante de Filtros
100100
│ │ ├── validator.py # Verificador de Templates
101101
│ │ └── strategies/ # Módulos de Lógica de Formatação

static/js/i18n.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,26 @@
44
*/
55
class I18nHandler {
66
constructor() {
7+
// 1. State Initialization (Immediate)
8+
// Must run immediately so other scripts (like navbar.js) can access i18n.currentLang right away
79
this.currentLang = localStorage.getItem('logicpaper_lang') || 'en';
810
this.translations = TRANSLATIONS;
11+
12+
// 2. DOM Initialization (Deferred)
913
this.init();
1014
}
1115

1216
/**
13-
* Initializes the page language.
17+
* Initializes the page language logic.
18+
* Listens for DOMContentLoaded to ensure elements exist before translation.
1419
*/
1520
init() {
16-
this.setLanguage(this.currentLang);
21+
// Safety Check: If DOM is already ready, update immediately. Otherwise, wait for the event
22+
if (document.readyState === 'loading') {
23+
document.addEventListener('DOMContentLoaded', () => this.updateDOM());
24+
} else {
25+
this.updateDOM();
26+
}
1727
}
1828

1929
/**

static/js/locales.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ const TRANSLATIONS = {
262262
sub: "Word ou PowerPoint"
263263
},
264264
drop_assets: {
265-
main: "Biblioteca de Ativos",
265+
main: "Biblioteca de Imagens",
266266
sub: "Opcional (.zip)"
267267
},
268268
btn_validate: "Verificar Compatibilidade",
@@ -289,14 +289,14 @@ const TRANSLATIONS = {
289289
btn_reset: "Começar de Novo"
290290
},
291291
preview: {
292-
title: "PREVIA_DADOS_FONTE.JSON",
292+
title: "PRÉVIA_DADOS_EXCEL.JSON",
293293
badge: "SOMENTE LEITURA",
294294
waiting: "Aguardando arquivo Excel...",
295295
step1: "Passo 1: Lendo Estrutura do Excel...",
296296
error: "Erro: "
297297
},
298298
logs: {
299-
title: "LOGS_EXECUCAO",
299+
title: "LOGS_EXECUÇÃO",
300300
ready: "Sistema pronto. Aguardando comando..."
301301
}
302302
},

0 commit comments

Comments
 (0)