@sankhyalabs/core-docs 0.0.0-feat-dev-KB-97809.1 → 0.0.0-feat-dev-KB-97809.2
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 +65 -13
- package/package.json +1 -1
package/classes/LangUtils.md
CHANGED
@@ -22,9 +22,11 @@
|
|
22
22
|
|
23
23
|
> `static` **ELanguages**: *typeof* `__class`
|
24
24
|
|
25
|
+
Classe estática contendo os códigos de idioma predefinidos.
|
26
|
+
|
25
27
|
#### Source
|
26
28
|
|
27
|
-
src/utils/LangUtils.ts:
|
29
|
+
src/utils/LangUtils.ts:9
|
28
30
|
|
29
31
|
## Methods
|
30
32
|
|
@@ -32,15 +34,21 @@ src/utils/LangUtils.ts:2
|
|
32
34
|
|
33
35
|
> `static` **applyLanguageFromCookie**(): `void`
|
34
36
|
|
35
|
-
Define o atributo lang no
|
37
|
+
Define o atributo `lang` no elemento `<html>` com base no cookie de idioma, se existir.
|
36
38
|
|
37
39
|
#### Returns
|
38
40
|
|
39
41
|
`void`
|
40
42
|
|
43
|
+
#### Example
|
44
|
+
|
45
|
+
```ts
|
46
|
+
LangUtils.applyLanguageFromCookie(); // Aplica o idioma do cookie ao elemento `<html>`
|
47
|
+
```
|
48
|
+
|
41
49
|
#### Source
|
42
50
|
|
43
|
-
src/utils/LangUtils.ts:
|
51
|
+
src/utils/LangUtils.ts:108
|
44
52
|
|
45
53
|
***
|
46
54
|
|
@@ -48,17 +56,30 @@ src/utils/LangUtils.ts:69
|
|
48
56
|
|
49
57
|
> `static` `private` **convertLanguage**(`lang`): `string`
|
50
58
|
|
59
|
+
Converte o idioma fornecido para um dos códigos predefinidos.
|
60
|
+
|
51
61
|
#### Parameters
|
52
62
|
|
53
63
|
• **lang**: `string`
|
54
64
|
|
65
|
+
O idioma a ser convertido (ex.: "en", "es", "pt-BR").
|
66
|
+
|
55
67
|
#### Returns
|
56
68
|
|
57
69
|
`string`
|
58
70
|
|
71
|
+
O código de idioma correspondente (ex.: "en_US", "es_ES").
|
72
|
+
|
73
|
+
#### Example
|
74
|
+
|
75
|
+
```ts
|
76
|
+
LangUtils.convertLanguage("en"); // Retorna "en_US"
|
77
|
+
LangUtils.convertLanguage("es-es"); // Retorna "es_ES"
|
78
|
+
```
|
79
|
+
|
59
80
|
#### Source
|
60
81
|
|
61
|
-
src/utils/LangUtils.ts:
|
82
|
+
src/utils/LangUtils.ts:25
|
62
83
|
|
63
84
|
***
|
64
85
|
|
@@ -66,15 +87,23 @@ src/utils/LangUtils.ts:8
|
|
66
87
|
|
67
88
|
> `static` **getHtmlLanguage**(): `string`
|
68
89
|
|
69
|
-
|
90
|
+
Recupera o valor do atributo `lang` do elemento `<html>`.
|
70
91
|
|
71
92
|
#### Returns
|
72
93
|
|
73
94
|
`string`
|
74
95
|
|
96
|
+
O idioma definido no elemento `<html>` ou o padrão.
|
97
|
+
|
98
|
+
#### Example
|
99
|
+
|
100
|
+
```ts
|
101
|
+
LangUtils.getHtmlLanguage(); // Retorna "pt_BR" no modo desenvolvimento
|
102
|
+
```
|
103
|
+
|
75
104
|
#### Source
|
76
105
|
|
77
|
-
src/utils/LangUtils.ts:
|
106
|
+
src/utils/LangUtils.ts:66
|
78
107
|
|
79
108
|
***
|
80
109
|
|
@@ -82,15 +111,23 @@ src/utils/LangUtils.ts:39
|
|
82
111
|
|
83
112
|
> `static` **getLanguage**(): `string`
|
84
113
|
|
85
|
-
Captura
|
114
|
+
Captura o idioma atualmente definido.
|
86
115
|
|
87
116
|
#### Returns
|
88
117
|
|
89
118
|
`string`
|
90
119
|
|
120
|
+
O idioma definido (ex.: "pt_BR", "en_US").
|
121
|
+
|
122
|
+
#### Example
|
123
|
+
|
124
|
+
```ts
|
125
|
+
LangUtils.getLanguage(); // Retorna o idioma atual
|
126
|
+
```
|
127
|
+
|
91
128
|
#### Source
|
92
129
|
|
93
|
-
src/utils/LangUtils.ts:
|
130
|
+
src/utils/LangUtils.ts:48
|
94
131
|
|
95
132
|
***
|
96
133
|
|
@@ -98,15 +135,23 @@ src/utils/LangUtils.ts:26
|
|
98
135
|
|
99
136
|
> `static` **getLanguageFromCookie**(): `null` \| `string`
|
100
137
|
|
101
|
-
Recupera o valor do cookie de
|
138
|
+
Recupera o valor do cookie de idioma.
|
102
139
|
|
103
140
|
#### Returns
|
104
141
|
|
105
142
|
`null` \| `string`
|
106
143
|
|
144
|
+
O valor do cookie de idioma ou `null` se não existir.
|
145
|
+
|
146
|
+
#### Example
|
147
|
+
|
148
|
+
```ts
|
149
|
+
LangUtils.getLanguageFromCookie(); // Retorna "pt_BR" se o cookie existir
|
150
|
+
```
|
151
|
+
|
107
152
|
#### Source
|
108
153
|
|
109
|
-
src/utils/LangUtils.ts:
|
154
|
+
src/utils/LangUtils.ts:97
|
110
155
|
|
111
156
|
***
|
112
157
|
|
@@ -114,17 +159,24 @@ src/utils/LangUtils.ts:61
|
|
114
159
|
|
115
160
|
> `static` **setHtmlLanguage**(`language`): `void`
|
116
161
|
|
117
|
-
|
118
|
-
e atualiza o cookie de linguagem
|
162
|
+
Define o atributo `lang` no elemento `<html>` e atualiza o cookie de idioma.
|
119
163
|
|
120
164
|
#### Parameters
|
121
165
|
|
122
166
|
• **language**: `string`
|
123
167
|
|
168
|
+
O idioma a ser definido (ex.: "pt_BR", "en_US").
|
169
|
+
|
124
170
|
#### Returns
|
125
171
|
|
126
172
|
`void`
|
127
173
|
|
174
|
+
#### Example
|
175
|
+
|
176
|
+
```ts
|
177
|
+
LangUtils.setHtmlLanguage("en_US"); // Define o idioma como "en_US"
|
178
|
+
```
|
179
|
+
|
128
180
|
#### Source
|
129
181
|
|
130
|
-
src/utils/LangUtils.ts:
|
182
|
+
src/utils/LangUtils.ts:84
|