@sankhyalabs/core-docs 0.0.0-feat-dev-KB-97809.2 → 0.0.0-feat-dev-KB-94839.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/classes/LangUtils.md +22 -9
- package/package.json +1 -1
package/classes/LangUtils.md
CHANGED
@@ -6,6 +6,9 @@
|
|
6
6
|
|
7
7
|
# Class: LangUtils
|
8
8
|
|
9
|
+
A classe `LangUtils` fornece métodos utilitários para gerenciar configurações de
|
10
|
+
idioma, incluindo recuperar, definir e aplicar preferências de idioma.
|
11
|
+
|
9
12
|
## Constructors
|
10
13
|
|
11
14
|
### new LangUtils()
|
@@ -26,7 +29,7 @@ Classe estática contendo os códigos de idioma predefinidos.
|
|
26
29
|
|
27
30
|
#### Source
|
28
31
|
|
29
|
-
src/utils/LangUtils.ts:
|
32
|
+
src/utils/LangUtils.ts:14
|
30
33
|
|
31
34
|
## Methods
|
32
35
|
|
@@ -48,7 +51,7 @@ LangUtils.applyLanguageFromCookie(); // Aplica o idioma do cookie ao elemento `<
|
|
48
51
|
|
49
52
|
#### Source
|
50
53
|
|
51
|
-
src/utils/LangUtils.ts:
|
54
|
+
src/utils/LangUtils.ts:123
|
52
55
|
|
53
56
|
***
|
54
57
|
|
@@ -79,7 +82,7 @@ LangUtils.convertLanguage("es-es"); // Retorna "es_ES"
|
|
79
82
|
|
80
83
|
#### Source
|
81
84
|
|
82
|
-
src/utils/LangUtils.ts:
|
85
|
+
src/utils/LangUtils.ts:30
|
83
86
|
|
84
87
|
***
|
85
88
|
|
@@ -87,7 +90,9 @@ src/utils/LangUtils.ts:25
|
|
87
90
|
|
88
91
|
> `static` **getHtmlLanguage**(): `string`
|
89
92
|
|
90
|
-
Recupera o valor do atributo `lang` do elemento `<html>`.
|
93
|
+
Recupera o valor do atributo `lang` do elemento `<html>`. Se o ambiente
|
94
|
+
estiver em modo de desenvolvimento, o idioma padrão será `"pt_BR"`. Caso
|
95
|
+
contrário, utiliza o idioma do navegador ou `"pt-BR"` como padrão.
|
91
96
|
|
92
97
|
#### Returns
|
93
98
|
|
@@ -103,7 +108,7 @@ LangUtils.getHtmlLanguage(); // Retorna "pt_BR" no modo desenvolvimento
|
|
103
108
|
|
104
109
|
#### Source
|
105
110
|
|
106
|
-
src/utils/LangUtils.ts:
|
111
|
+
src/utils/LangUtils.ts:77
|
107
112
|
|
108
113
|
***
|
109
114
|
|
@@ -111,7 +116,11 @@ src/utils/LangUtils.ts:66
|
|
111
116
|
|
112
117
|
> `static` **getLanguage**(): `string`
|
113
118
|
|
114
|
-
Captura o idioma atualmente definido.
|
119
|
+
Captura o idioma atualmente definido. Primeiro verifica se há um idioma
|
120
|
+
armazenado nos cookies. Caso contrário, utiliza o idioma definido no elemento
|
121
|
+
`<html>`. Se nenhum valor for encontrado nos cookies ou no elemento `<html>`,
|
122
|
+
é utilizada a configuração do navegador. Caso o navegador também não forneça
|
123
|
+
um idioma, o padrão será `"pt_BR"`.
|
115
124
|
|
116
125
|
#### Returns
|
117
126
|
|
@@ -127,7 +136,7 @@ LangUtils.getLanguage(); // Retorna o idioma atual
|
|
127
136
|
|
128
137
|
#### Source
|
129
138
|
|
130
|
-
src/utils/LangUtils.ts:
|
139
|
+
src/utils/LangUtils.ts:57
|
131
140
|
|
132
141
|
***
|
133
142
|
|
@@ -151,7 +160,7 @@ LangUtils.getLanguageFromCookie(); // Retorna "pt_BR" se o cookie existir
|
|
151
160
|
|
152
161
|
#### Source
|
153
162
|
|
154
|
-
src/utils/LangUtils.ts:
|
163
|
+
src/utils/LangUtils.ts:112
|
155
164
|
|
156
165
|
***
|
157
166
|
|
@@ -167,6 +176,10 @@ Define o atributo `lang` no elemento `<html>` e atualiza o cookie de idioma.
|
|
167
176
|
|
168
177
|
O idioma a ser definido (ex.: "pt_BR", "en_US").
|
169
178
|
|
179
|
+
> **Nota:** Definir o idioma no elemento `<html>` é essencial para garantir que o conteúdo
|
180
|
+
da página seja interpretado corretamente por navegadores, leitores de tela e mecanismos de
|
181
|
+
busca, melhorando a acessibilidade e a indexação.
|
182
|
+
|
170
183
|
#### Returns
|
171
184
|
|
172
185
|
`void`
|
@@ -179,4 +192,4 @@ LangUtils.setHtmlLanguage("en_US"); // Define o idioma como "en_US"
|
|
179
192
|
|
180
193
|
#### Source
|
181
194
|
|
182
|
-
src/utils/LangUtils.ts:
|
195
|
+
src/utils/LangUtils.ts:99
|