@intlayer/docs 9.3.2 → 9.3.3
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/blog/ar/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/de/nextjs-multilingual-seo-comparison.md +9 -9
- package/blog/en/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/en-GB/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/es/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/fr/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/hi/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/id/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/it/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/ja/nextjs-multilingual-seo-comparison.md +9 -9
- package/blog/ko/nextjs-multilingual-seo-comparison.md +9 -9
- package/blog/pl/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/pt/nextjs-multilingual-seo-comparison.md +9 -9
- package/blog/ru/nextjs-multilingual-seo-comparison.md +9 -9
- package/blog/tr/nextjs-multilingual-seo-comparison.md +9 -9
- package/blog/uk/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/vi/nextjs-multilingual-seo-comparison.md +10 -10
- package/blog/zh/nextjs-multilingual-seo-comparison.md +10 -10
- package/docs/ar/bundle_optimization.md +1 -1
- package/docs/ar/configuration.md +32 -9
- package/docs/ar/dictionary/content_file.md +0 -22
- package/docs/ar/dictionary/function_fetching.md +23 -0
- package/docs/ar/eslint.md +9 -9
- package/docs/bn/configuration.md +34 -9
- package/docs/bn/eslint.md +9 -9
- package/docs/cs/bundle_optimization.md +1 -1
- package/docs/cs/configuration.md +33 -9
- package/docs/cs/eslint.md +9 -9
- package/docs/de/bundle_optimization.md +1 -1
- package/docs/de/configuration.md +34 -9
- package/docs/de/dictionary/content_file.md +0 -22
- package/docs/de/dictionary/function_fetching.md +23 -0
- package/docs/de/eslint.md +9 -9
- package/docs/en/bundle_optimization.md +1 -1
- package/docs/en/configuration.md +34 -9
- package/docs/en/dictionary/content_file.md +0 -22
- package/docs/en/dictionary/function_fetching.md +23 -0
- package/docs/en/eslint.md +9 -9
- package/docs/en/packages/intlayer/getLocalizedPath.md +70 -19
- package/docs/en-GB/configuration.md +33 -9
- package/docs/en-GB/dictionary/content_file.md +0 -22
- package/docs/en-GB/dictionary/function_fetching.md +23 -0
- package/docs/en-GB/eslint.md +9 -9
- package/docs/es/bundle_optimization.md +1 -1
- package/docs/es/configuration.md +35 -9
- package/docs/es/dictionary/content_file.md +0 -22
- package/docs/es/dictionary/function_fetching.md +23 -0
- package/docs/es/eslint.md +9 -9
- package/docs/fr/bundle_optimization.md +1 -1
- package/docs/fr/configuration.md +35 -9
- package/docs/fr/dictionary/content_file.md +0 -22
- package/docs/fr/dictionary/function_fetching.md +23 -0
- package/docs/fr/eslint.md +9 -9
- package/docs/hi/configuration.md +35 -9
- package/docs/hi/dictionary/content_file.md +0 -22
- package/docs/hi/dictionary/function_fetching.md +23 -0
- package/docs/hi/eslint.md +9 -9
- package/docs/id/configuration.md +35 -9
- package/docs/id/dictionary/content_file.md +0 -22
- package/docs/id/dictionary/function_fetching.md +23 -0
- package/docs/id/eslint.md +9 -9
- package/docs/it/bundle_optimization.md +1 -1
- package/docs/it/configuration.md +35 -9
- package/docs/it/dictionary/content_file.md +0 -22
- package/docs/it/dictionary/function_fetching.md +23 -0
- package/docs/it/eslint.md +9 -9
- package/docs/ja/configuration.md +30 -9
- package/docs/ja/dictionary/content_file.md +0 -22
- package/docs/ja/dictionary/function_fetching.md +23 -0
- package/docs/ja/eslint.md +9 -9
- package/docs/ko/configuration.md +31 -9
- package/docs/ko/dictionary/content_file.md +0 -22
- package/docs/ko/dictionary/function_fetching.md +23 -0
- package/docs/ko/eslint.md +9 -9
- package/docs/nl/configuration.md +33 -9
- package/docs/nl/eslint.md +9 -9
- package/docs/pl/bundle_optimization.md +1 -1
- package/docs/pl/configuration.md +34 -9
- package/docs/pl/dictionary/content_file.md +0 -22
- package/docs/pl/dictionary/function_fetching.md +23 -0
- package/docs/pl/eslint.md +9 -9
- package/docs/pt/bundle_optimization.md +1 -1
- package/docs/pt/configuration.md +34 -9
- package/docs/pt/dictionary/content_file.md +0 -22
- package/docs/pt/dictionary/function_fetching.md +23 -0
- package/docs/pt/eslint.md +9 -9
- package/docs/ru/bundle_optimization.md +1 -1
- package/docs/ru/configuration.md +34 -9
- package/docs/ru/dictionary/content_file.md +0 -22
- package/docs/ru/dictionary/function_fetching.md +23 -0
- package/docs/ru/eslint.md +9 -9
- package/docs/tr/bundle_optimization.md +1 -1
- package/docs/tr/configuration.md +33 -9
- package/docs/tr/dictionary/content_file.md +0 -22
- package/docs/tr/dictionary/function_fetching.md +23 -0
- package/docs/tr/eslint.md +9 -9
- package/docs/uk/configuration.md +35 -9
- package/docs/uk/dictionary/content_file.md +0 -22
- package/docs/uk/dictionary/function_fetching.md +23 -0
- package/docs/uk/eslint.md +9 -9
- package/docs/ur/configuration.md +35 -9
- package/docs/ur/eslint.md +9 -9
- package/docs/vi/bundle_optimization.md +1 -1
- package/docs/vi/configuration.md +33 -9
- package/docs/vi/dictionary/content_file.md +0 -22
- package/docs/vi/dictionary/function_fetching.md +23 -0
- package/docs/vi/eslint.md +9 -9
- package/docs/zh/bundle_optimization.md +1 -1
- package/docs/zh/configuration.md +29 -9
- package/docs/zh/dictionary/content_file.md +0 -22
- package/docs/zh/dictionary/function_fetching.md +23 -0
- package/docs/zh/eslint.md +9 -9
- package/docs/zh-TW/bundle_optimization.md +1 -1
- package/docs/zh-TW/eslint.md +9 -9
- package/package.json +5 -5
|
@@ -533,28 +533,6 @@ Usado em conjunto com as Variantes, este campo define alternativas de conteúdo
|
|
|
533
533
|
|
|
534
534
|
> Veja [Variantes](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/dynamic_dictionaries/variants.md) para mais informações.
|
|
535
535
|
|
|
536
|
-
#### `meta` (`Record<string, string | number | boolean>`)
|
|
537
|
-
|
|
538
|
-
Usado em conjunto com os Registros Dinâmicos, este campo permite declarar registros gerenciados pelo CMS ou dados arbitrários buscados em tempo de execução por um ID opaco. A identidade do dicionário é definida pelo conjunto arbitrário de pares chave-valor declarados neste campo `meta`.
|
|
539
|
-
|
|
540
|
-
**Exemplo:**
|
|
541
|
-
|
|
542
|
-
```typescript
|
|
543
|
-
{
|
|
544
|
-
key: "product-copy",
|
|
545
|
-
meta: {
|
|
546
|
-
id: "prod_abc",
|
|
547
|
-
userId: "user_123"
|
|
548
|
-
},
|
|
549
|
-
content: {
|
|
550
|
-
name: "Widget Pro",
|
|
551
|
-
description: "The best widget."
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
> Veja [Registros Dinâmicos](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/dynamic_dictionaries/dynamic_content.md) para mais informações.
|
|
557
|
-
|
|
558
536
|
### Propriedades do CMS
|
|
559
537
|
|
|
560
538
|
##### `version` (string)
|
|
@@ -89,6 +89,29 @@ Não é possível buscar conteúdo de um arquivo JSON, use um arquivo .ts ou .js
|
|
|
89
89
|
|
|
90
90
|
Neste caso, a função `fakeFetch` simula um atraso para imitar o tempo de resposta do servidor. O Intlayer executa a função assíncrona e usa o resultado como o conteúdo para a chave `text`.
|
|
91
91
|
|
|
92
|
+
## Buscando Conteúdo Remoto
|
|
93
|
+
|
|
94
|
+
Você também pode atribuir uma promise diretamente a um campo de conteúdo. O Intlayer a aguarda durante a construção dos dicionários e insere o valor resolvido:
|
|
95
|
+
|
|
96
|
+
```typescript fileName="**/*.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
|
|
97
|
+
import type { Dictionary } from "intlayer";
|
|
98
|
+
|
|
99
|
+
const remoteContent = {
|
|
100
|
+
key: "remote_content",
|
|
101
|
+
content: {
|
|
102
|
+
externalContent: fetch("https://example.com").then((res) => res.json()),
|
|
103
|
+
},
|
|
104
|
+
} satisfies Dictionary;
|
|
105
|
+
|
|
106
|
+
export default remoteContent;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```plaintext fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
110
|
+
Não é possível buscar conteúdo de um arquivo JSON, use um arquivo .ts ou .js em vez disso
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
> A requisição é executada em tempo de build, portanto os dados buscados são um instantâneo embutido no dicionário. Reconstrua seus dicionários para atualizá-los.
|
|
114
|
+
|
|
92
115
|
## Usando Conteúdo Baseado em Função em Componentes React
|
|
93
116
|
|
|
94
117
|
Para usar conteúdo baseado em função em um componente React, você precisa importar `useIntlayer` de `react-intlayer` e chamá-lo com o ID do conteúdo para recuperar o conteúdo. Aqui está um exemplo:
|
package/docs/pt/eslint.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2026-08-12
|
|
3
|
-
updatedAt: 2026-08-
|
|
3
|
+
updatedAt: 2026-08-13
|
|
4
4
|
title: Plugin ESLint | Regras de lint para o Intlayer
|
|
5
5
|
description: Detecte strings codificadas diretamente, chamadas dinâmicas que o compilador do Intlayer não consegue otimizar e conteúdo de dicionário não utilizado com eslint-plugin-intlayer. Compatível com ESLint e oxlint, no React, Vue, Svelte, Angular e Astro.
|
|
6
6
|
keywords:
|
|
@@ -52,7 +52,7 @@ pnpm add --save-dev eslint-plugin-intlayer
|
|
|
52
52
|
yarn add --dev eslint-plugin-intlayer
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Requer o ESLint 9 ou superior (flat config).
|
|
55
|
+
Requer o ESLint 9 ou superior (flat config). O ESLint 10 é compatível.
|
|
56
56
|
|
|
57
57
|
## Utilização
|
|
58
58
|
|
|
@@ -61,20 +61,20 @@ O plugin funciona tanto no ESLint quanto no [oxlint](https://oxc.rs) — com as
|
|
|
61
61
|
<Tabs defaultTab="eslint">
|
|
62
62
|
<Tab label="ESLint" value="eslint">
|
|
63
63
|
|
|
64
|
-
```javascript fileName="eslint.config.mjs"
|
|
64
|
+
```javascript fileName="eslint.config.mjs"
|
|
65
65
|
import intlayer from "eslint-plugin-intlayer";
|
|
66
66
|
|
|
67
67
|
export default [...intlayer.configs.recommended];
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Ou
|
|
70
|
+
Ou espalhe uma configuração e defina você mesmo as severidades:
|
|
71
71
|
|
|
72
|
-
```javascript fileName="eslint.config.mjs"
|
|
72
|
+
```javascript fileName="eslint.config.mjs"
|
|
73
73
|
import intlayer from "eslint-plugin-intlayer";
|
|
74
74
|
|
|
75
75
|
export default [
|
|
76
|
+
...intlayer.configs.recommended,
|
|
76
77
|
{
|
|
77
|
-
plugins: { intlayer },
|
|
78
78
|
rules: {
|
|
79
79
|
"intlayer/no-raw-text": "warn",
|
|
80
80
|
"intlayer/static-dictionary-key": "error",
|
|
@@ -144,7 +144,7 @@ Para corrigir um arquivo inteiro de uma só vez, execute `npx intlayer extract`
|
|
|
144
144
|
|
|
145
145
|
**Opções**
|
|
146
146
|
|
|
147
|
-
```javascript fileName="eslint.config.mjs"
|
|
147
|
+
```javascript fileName="eslint.config.mjs"
|
|
148
148
|
{
|
|
149
149
|
"intlayer/no-raw-text": [
|
|
150
150
|
"warn",
|
|
@@ -247,7 +247,7 @@ Ao contrário das outras regras, esta não pode responder apenas com base no arq
|
|
|
247
247
|
|
|
248
248
|
**Opções**
|
|
249
249
|
|
|
250
|
-
```javascript fileName="eslint.config.mjs"
|
|
250
|
+
```javascript fileName="eslint.config.mjs"
|
|
251
251
|
{
|
|
252
252
|
"intlayer/no-unused-content": [
|
|
253
253
|
"warn",
|
|
@@ -296,7 +296,7 @@ Todas as regras funcionam em todas as integrações do Intlayer, inclusive dentr
|
|
|
296
296
|
| Templates do Angular | `.component.html` | `@angular-eslint/template-parser` |
|
|
297
297
|
| Astro | `.astro` | `astro-eslint-parser` |
|
|
298
298
|
|
|
299
|
-
```javascript fileName="eslint.config.mjs"
|
|
299
|
+
```javascript fileName="eslint.config.mjs"
|
|
300
300
|
import intlayer from "eslint-plugin-intlayer";
|
|
301
301
|
import tseslint from "typescript-eslint";
|
|
302
302
|
import vueParser from "vue-eslint-parser";
|
|
@@ -159,7 +159,7 @@ pnpm add -D webpack-bundle-analyzer
|
|
|
159
159
|
bun add -d webpack-bundle-analyzer
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
```typescript fileName="webpack.config.ts
|
|
162
|
+
```typescript fileName="webpack.config.ts"
|
|
163
163
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
|
164
164
|
|
|
165
165
|
export default {
|
package/docs/ru/configuration.md
CHANGED
|
@@ -478,6 +478,29 @@ const config: IntlayerConfig = {
|
|
|
478
478
|
*/
|
|
479
479
|
purge: true,
|
|
480
480
|
|
|
481
|
+
/**
|
|
482
|
+
* Группировать чанки словарей по локали в соответствии с границей разделения
|
|
483
|
+
* кода, которая их использует, чтобы лениво загружаемая страница получала своё
|
|
484
|
+
* содержимое одним запросом.
|
|
485
|
+
* По умолчанию: true
|
|
486
|
+
*
|
|
487
|
+
* Примечание:
|
|
488
|
+
* - Применяется только к словарям с `importMode: 'dynamic'`.
|
|
489
|
+
*/
|
|
490
|
+
chunkGrouping: true,
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Загружать словарь вместе с чанком, который его использует, вместо получения
|
|
494
|
+
* после отрисовки этого чанка. Чтения отрисовываются синхронно вместо
|
|
495
|
+
* приостановки, поэтому при навигации больше не мелькает состояние загрузки.
|
|
496
|
+
* По умолчанию: true
|
|
497
|
+
*
|
|
498
|
+
* Примечание:
|
|
499
|
+
* - Ожидается только разрешённая локаль, поэтому страница загружает лишь тот
|
|
500
|
+
* язык, который отображает.
|
|
501
|
+
*/
|
|
502
|
+
dictionariesPreload: true,
|
|
503
|
+
|
|
481
504
|
/**
|
|
482
505
|
* Формат вывода для сгенерированных файлов словарей.
|
|
483
506
|
* По умолчанию: ['cjs', 'esm']
|
|
@@ -1054,15 +1077,17 @@ Intlayer поддерживает несколько ИИ-провайдеров
|
|
|
1054
1077
|
|
|
1055
1078
|
> Во время оптимизации Intlayer заменит вызовы словарей для оптимизации чанкинга (chunking), чтобы итоговый бандл импортировал только те словари, которые действительно используются.
|
|
1056
1079
|
|
|
1057
|
-
| Поле
|
|
1058
|
-
|
|
|
1059
|
-
| `mode`
|
|
1060
|
-
| `optimize`
|
|
1061
|
-
| `minify`
|
|
1062
|
-
| `purge`
|
|
1063
|
-
| `checkTypes`
|
|
1064
|
-
| `
|
|
1065
|
-
| `
|
|
1080
|
+
| Поле | Описание | Тип | По умолчанию | Пример | Примечание |
|
|
1081
|
+
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1082
|
+
| `mode` | Управляет режимом сборки. | `'auto'` | <br/> `'manual'` | `'auto'` | `'manual'` | • `'auto'`: сборка запускается автоматически при сборке приложения.<br/>• `'manual'`: выполняется только при явном вызове команды сборки.<br/>• Можно использовать для отключения сборки словарей (например, чтобы избежать выполнения в средах Node.js). |
|
|
1083
|
+
| `optimize` | Управляет тем, должна ли выполняться оптимизация сборки. | `boolean` | `undefined` | `process.env.NODE_ENV === 'production'` | • Если не определено, оптимизация запускается при сборке фреймворка (Vite/Next.js).<br/>• `true` форсирует оптимизацию даже в dev режиме.<br/>• `false` отключает ее.<br/>• Если включено, заменяет вызовы словарей для оптимизации чанкинга.<br/>• Требует плагины `@intlayer/babel` и `@intlayer/swc`. |
|
|
1084
|
+
| `minify` | Минимизировать словари для уменьшения размера бандла. | `boolean` | `false` | | • Указывает, должен ли бандл быть минифицирован.<br/>• По умолчанию: `true` в продакшене.<br/>• Эта опция будет проигнорирована, если `optimize` отключена.<br/>• Эта опция будет проигнорирована, если `editor.enabled` имеет значение true. |
|
|
1085
|
+
| `purge` | Удалить неиспользуемые ключи в словарях. | `boolean` | `false` | | • Указывает, должен ли бандл быть очищен.<br/>• По умолчанию: `true` в продакшене.<br/>• Эта опция будет проигнорирована, если `optimize` отключена. |
|
|
1086
|
+
| `checkTypes` | Указывает, должна ли сборка проверять типы TypeScript и логировать ошибки. | `boolean` | `false` | | Может замедлить процесс сборки. |
|
|
1087
|
+
| `chunkGrouping` | Определяет, следует ли группировать чанки словарей по локали в соответствии с границей разделения кода, которая их использует. | `boolean` | `true` | | • Без группировки страница, собранная из множества компонентов, отправляет по одному запросу на каждый словарь.<br/>• Словари, достижимые из нескольких границ, переносятся в общий чанк, поэтому ни одна страница не содержит контент другой.<br/>• Применяется только к словарям с `importMode: 'dynamic'`.<br/>• Применяется только к клиентской сборке и только при бандлинге (не в режиме разработки). |
|
|
1088
|
+
| `dictionariesPreload` | Определяет, должен ли словарь загружаться вместе с чанком, который его использует, вместо получения после отрисовки этого чанка. | `boolean` | `true` | | • Сгенерированная точка входа ожидает локаль просмотра на верхнем уровне, поэтому лениво загружаемый маршрут не считается загруженным, пока его содержимое не готово.<br/>• Чтения отрисовываются синхронно вместо приостановки, поэтому при навигации больше не мелькает состояние загрузки.<br/>• Ожидается только разрешённая локаль, поэтому страница загружает лишь тот язык, который отображает.<br/>• Применяется только к словарям с `importMode: 'dynamic'` в клиентской сборке.<br/>• Требуется сборщик с поддержкой top-level await (Vite, esbuild). |
|
|
1089
|
+
| `outputFormat` | Управляет выходным форматом словарей. | `('esm' | 'cjs')[]` | `['esm', 'cjs']` | `['cjs']` | |
|
|
1090
|
+
| `traversePattern` | Шаблоны, определяющие, какие файлы сканировать во время оптимизации. | `string[]` | `['**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}', '!**/node_modules/**', '!**/dist/**', '!**/.intlayer/**', '!**/*.config.*', '!**/*.test.*', '!**/*.spec.*', '!**/*.stories.*']` | `['src/**/*.{ts,tsx}', '../ui-library/**/*.{ts,tsx}', '!**/node_modules/**']` | • Ограничьте оптимизацию релевантными файлами для повышения производительности сборки.<br/>• Игнорирует, если `optimize` выключен.<br/>• Использует шаблоны glob. |
|
|
1066
1091
|
|
|
1067
1092
|
---
|
|
1068
1093
|
|
|
@@ -536,28 +536,6 @@ export default aboutPageMetaContent;
|
|
|
536
536
|
|
|
537
537
|
> См. [Варианты](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ru/dynamic_dictionaries/variants.md) для получения дополнительной информации.
|
|
538
538
|
|
|
539
|
-
#### `meta` (`Record<string, string | number | boolean>`)
|
|
540
|
-
|
|
541
|
-
Используемое в сочетании с Динамическими Записями, это поле позволяет объявлять записи, управляемые CMS, или произвольные данные, извлекаемые во время выполнения по непрозрачному ID. Идентификация словаря определяется произвольным набором пар ключ-значение, объявленных в этом поле `meta`.
|
|
542
|
-
|
|
543
|
-
**Пример:**
|
|
544
|
-
|
|
545
|
-
```typescript
|
|
546
|
-
{
|
|
547
|
-
key: "product-copy",
|
|
548
|
-
meta: {
|
|
549
|
-
id: "prod_abc",
|
|
550
|
-
userId: "user_123"
|
|
551
|
-
},
|
|
552
|
-
content: {
|
|
553
|
-
name: "Widget Pro",
|
|
554
|
-
description: "The best widget."
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
> См. [Динамические Записи](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ru/dynamic_dictionaries/dynamic_content.md) для получения дополнительной информации.
|
|
560
|
-
|
|
561
539
|
### Свойства CMS
|
|
562
540
|
|
|
563
541
|
##### `version` (строка)
|
|
@@ -87,6 +87,29 @@ export default asyncFunctionContent;
|
|
|
87
87
|
|
|
88
88
|
В этом случае функция `fakeFetch` имитирует задержку, чтобы смоделировать время отклика сервера. Intlayer выполняет асинхронную функцию и использует результат в качестве содержимого для ключа `text`.
|
|
89
89
|
|
|
90
|
+
## Получение удалённого контента
|
|
91
|
+
|
|
92
|
+
Вы также можете присвоить промис непосредственно полю контента. Intlayer дождётся его при сборке словарей и подставит полученное значение:
|
|
93
|
+
|
|
94
|
+
```typescript fileName="**/*.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
|
|
95
|
+
import type { Dictionary } from "intlayer";
|
|
96
|
+
|
|
97
|
+
const remoteContent = {
|
|
98
|
+
key: "remote_content",
|
|
99
|
+
content: {
|
|
100
|
+
externalContent: fetch("https://example.com").then((res) => res.json()),
|
|
101
|
+
},
|
|
102
|
+
} satisfies Dictionary;
|
|
103
|
+
|
|
104
|
+
export default remoteContent;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```plaintext fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
108
|
+
Невозможно получить контент из JSON-файла, используйте вместо этого файл .ts или .js
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> Запрос выполняется во время сборки, поэтому полученные данные — это снимок, встроенный в словарь. Пересоберите словари, чтобы обновить их.
|
|
112
|
+
|
|
90
113
|
## Использование контента на основе функций в React-компонентах
|
|
91
114
|
|
|
92
115
|
Чтобы использовать контент на основе функций в React-компоненте, необходимо импортировать `useIntlayer` из `react-intlayer` и вызвать его с идентификатором контента для получения содержимого. Вот пример:
|
package/docs/ru/eslint.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2026-08-12
|
|
3
|
-
updatedAt: 2026-08-
|
|
3
|
+
updatedAt: 2026-08-13
|
|
4
4
|
title: Плагин ESLint | Правила линтинга для Intlayer
|
|
5
5
|
description: Находите жестко закодированные строки, динамические вызовы, которые компилятор Intlayer не может оптимизировать, и неиспользуемый контент словарей с помощью eslint-plugin-intlayer. Работает с ESLint и oxlint для React, Vue, Svelte, Angular и Astro.
|
|
6
6
|
keywords:
|
|
@@ -52,7 +52,7 @@ pnpm add --save-dev eslint-plugin-intlayer
|
|
|
52
52
|
yarn add --dev eslint-plugin-intlayer
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Требуется ESLint 9 или новее (flat config).
|
|
55
|
+
Требуется ESLint 9 или новее (flat config). ESLint 10 поддерживается.
|
|
56
56
|
|
|
57
57
|
## Использование
|
|
58
58
|
|
|
@@ -61,20 +61,20 @@ yarn add --dev eslint-plugin-intlayer
|
|
|
61
61
|
<Tabs defaultTab="eslint">
|
|
62
62
|
<Tab label="ESLint" value="eslint">
|
|
63
63
|
|
|
64
|
-
```javascript fileName="eslint.config.mjs"
|
|
64
|
+
```javascript fileName="eslint.config.mjs"
|
|
65
65
|
import intlayer from "eslint-plugin-intlayer";
|
|
66
66
|
|
|
67
67
|
export default [...intlayer.configs.recommended];
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Либо
|
|
70
|
+
Либо разверните конфигурацию и задайте уровни сами:
|
|
71
71
|
|
|
72
|
-
```javascript fileName="eslint.config.mjs"
|
|
72
|
+
```javascript fileName="eslint.config.mjs"
|
|
73
73
|
import intlayer from "eslint-plugin-intlayer";
|
|
74
74
|
|
|
75
75
|
export default [
|
|
76
|
+
...intlayer.configs.recommended,
|
|
76
77
|
{
|
|
77
|
-
plugins: { intlayer },
|
|
78
78
|
rules: {
|
|
79
79
|
"intlayer/no-raw-text": "warn",
|
|
80
80
|
"intlayer/static-dictionary-key": "error",
|
|
@@ -144,7 +144,7 @@ const { title } = useIntlayer("home");
|
|
|
144
144
|
|
|
145
145
|
**Параметры**
|
|
146
146
|
|
|
147
|
-
```javascript fileName="eslint.config.mjs"
|
|
147
|
+
```javascript fileName="eslint.config.mjs"
|
|
148
148
|
{
|
|
149
149
|
"intlayer/no-raw-text": [
|
|
150
150
|
"warn",
|
|
@@ -247,7 +247,7 @@ export default {
|
|
|
247
247
|
|
|
248
248
|
**Параметры**
|
|
249
249
|
|
|
250
|
-
```javascript fileName="eslint.config.mjs"
|
|
250
|
+
```javascript fileName="eslint.config.mjs"
|
|
251
251
|
{
|
|
252
252
|
"intlayer/no-unused-content": [
|
|
253
253
|
"warn",
|
|
@@ -296,7 +296,7 @@ export default {
|
|
|
296
296
|
| Шаблоны Angular | `.component.html` | `@angular-eslint/template-parser` |
|
|
297
297
|
| Astro | `.astro` | `astro-eslint-parser` |
|
|
298
298
|
|
|
299
|
-
```javascript fileName="eslint.config.mjs"
|
|
299
|
+
```javascript fileName="eslint.config.mjs"
|
|
300
300
|
import intlayer from "eslint-plugin-intlayer";
|
|
301
301
|
import tseslint from "typescript-eslint";
|
|
302
302
|
import vueParser from "vue-eslint-parser";
|
|
@@ -159,7 +159,7 @@ pnpm add -D webpack-bundle-analyzer
|
|
|
159
159
|
bun add -d webpack-bundle-analyzer
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
```typescript fileName="webpack.config.ts
|
|
162
|
+
```typescript fileName="webpack.config.ts"
|
|
163
163
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
|
164
164
|
|
|
165
165
|
export default {
|
package/docs/tr/configuration.md
CHANGED
|
@@ -478,6 +478,28 @@ const config: IntlayerConfig = {
|
|
|
478
478
|
*/
|
|
479
479
|
purge: true,
|
|
480
480
|
|
|
481
|
+
/**
|
|
482
|
+
* Yerel ayara özgü sözlük parçalarını, onları kullanan kod bölme sınırına göre
|
|
483
|
+
* grupla; böylece geç yüklenen bir sayfa içeriğini tek istekte alır.
|
|
484
|
+
* Varsayılan: true
|
|
485
|
+
*
|
|
486
|
+
* Not:
|
|
487
|
+
* - Yalnızca `importMode: 'dynamic'` kullanan sözlükler için geçerlidir.
|
|
488
|
+
*/
|
|
489
|
+
chunkGrouping: true,
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Bir sözlüğü, onu kullanan parça render edildikten sonra getirmek yerine o
|
|
493
|
+
* parçayla birlikte yükle. Okumalar askıya alınmak yerine eşzamanlı render
|
|
494
|
+
* edilir, böylece gezinme sırasında artık yükleme durumu görünmez.
|
|
495
|
+
* Varsayılan: true
|
|
496
|
+
*
|
|
497
|
+
* Not:
|
|
498
|
+
* - Yalnızca çözümlenen yerel ayar beklenir, bu nedenle sayfa yalnızca
|
|
499
|
+
* gösterdiği dili indirir.
|
|
500
|
+
*/
|
|
501
|
+
dictionariesPreload: true,
|
|
502
|
+
|
|
481
503
|
/**
|
|
482
504
|
* Oluşturulan sözlük dosyaları için çıktı formatı.
|
|
483
505
|
* Varsayılan: ['cjs', 'esm']
|
|
@@ -1054,15 +1076,17 @@ Derleme seçenekleri `@intlayer/babel` ve `@intlayer/swc` eklentileri için geç
|
|
|
1054
1076
|
|
|
1055
1077
|
> Optimizasyon sırasında Intlayer, yığınlamayı (chunking) optimize etmek için sözlük çağrılarını değiştirecektir, böylece final paketi yalnızca gerçekte kullanılan sözlükleri içe aktaracaktır.
|
|
1056
1078
|
|
|
1057
|
-
| Alan
|
|
1058
|
-
|
|
|
1059
|
-
| `mode`
|
|
1060
|
-
| `optimize`
|
|
1061
|
-
| `minify`
|
|
1062
|
-
| `purge`
|
|
1063
|
-
| `checkTypes`
|
|
1064
|
-
| `
|
|
1065
|
-
| `
|
|
1079
|
+
| Alan | Açıklama | Tür | Varsayılan | Örnek | Not |
|
|
1080
|
+
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1081
|
+
| `mode` | Derleme modunu kontrol eder. | `'auto'` | <br/> `'manual'` | `'auto'` | `'manual'` | • `'auto'`: uygulama derlemesi sırasında derleme otomatik olarak tetiklenir.<br/>• `'manual'`: yalnızca derleme komutu açıkça çağrıldığında yürütülür.<br/>• Sözlük derlemelerini devre dışı bırakmak için kullanılabilir (örneğin Node.js ortamlarında yürütmeyi durdurmak için). |
|
|
1082
|
+
| `optimize` | Derlemenin optimize edilip edilmeyeceğini kontrol eder. | `boolean` | `undefined` | `process.env.NODE_ENV === 'production'` | • Tanımlanmazsa, optimizasyon framework derlemesinde (Vite/Next.js) tetiklenir.<br/>• `true` ise geliştirme modunda bile optimizasyonu zorlar.<br/>• `false` ise devre dışı bırakır.<br/>• Etkinse, yığınlamayı optimize etmek için sözlük çağrılarını yer değiştirir.<br/>• `@intlayer/babel` ve `@intlayer/swc` eklentilerini gerektirir. |
|
|
1083
|
+
| `minify` | Demet boyutunu azaltmak için sözlükleri küçültün (Minify). | `boolean` | `false` | | • Paketin küçültülüp küçültülmeyeceğini belirtir.<br/>• Varsayılan: Üretimde `true`.<br/>• `optimize` devre dışı bırakılırsa bu seçenek yoksayılır.<br/>• `editor.enabled` true ise bu seçenek yoksayılır. |
|
|
1084
|
+
| `purge` | Sözlüklerdeki kullanılmayan anahtarları temizleyin (Purge). | `boolean` | `false` | | • Paketin temizlenip temizlenmeyeceğini belirtir.<br/>• Varsayılan: Üretimde `true`.<br/>• `optimize` devre dışı bırakılırsa bu seçenek yoksayılır. |
|
|
1085
|
+
| `checkTypes` | Derlemenin TypeScript türlerini kontrol edip etmeyeceğini ve hataları günlüğe kaydedip kaydetmeyeceğini belirtir. | `boolean` | `false` | | Derleme sürecini yavaşlatabilir. |
|
|
1086
|
+
| `chunkGrouping` | Yerel ayara özgü sözlük parçalarının, onları kullanan kod bölme sınırına göre gruplanıp gruplanmayacağını belirtir. | `boolean` | `true` | | • Gruplama olmadan, çok sayıda bileşenden oluşan bir sayfa sözlük başına bir istek gönderir.<br/>• Birden fazla sınırdan erişilen sözlükler paylaşılan bir parçaya taşınır, böylece hiçbir sayfa başka bir sayfanın içeriğini taşımaz.<br/>• Yalnızca `importMode: 'dynamic'` kullanan sözlükler için geçerlidir.<br/>• Yalnızca istemci derlemesi için ve yalnızca paketleme sırasında geçerlidir (geliştirme modunda değil). |
|
|
1087
|
+
| `dictionariesPreload` | Bir sözlüğün, onu kullanan parça render edildikten sonra getirilmek yerine o parçayla birlikte yüklenip yüklenmeyeceğini belirtir. | `boolean` | `true` | | • Oluşturulan giriş noktası gezinme yerel ayarını en üst düzeyde bekler, bu nedenle geç yüklenen bir rota, içeriği hazır olana kadar yüklenmiş sayılmaz.<br/>• Okumalar askıya alınmak yerine eşzamanlı render edilir, böylece gezinme sırasında artık yükleme durumu görünmez.<br/>• Yalnızca çözümlenen yerel ayar beklenir, bu nedenle sayfa yalnızca gösterdiği dili indirir.<br/>• Yalnızca istemci derlemesinde `importMode: 'dynamic'` kullanan sözlükler için geçerlidir.<br/>• Top-level await destekleyen bir paketleyici gerektirir (Vite, esbuild). |
|
|
1088
|
+
| `outputFormat` | Sözlüklerin çıktı formatını kontrol eder. | `('esm' | 'cjs')[]` | `['esm', 'cjs']` | `['cjs']` | |
|
|
1089
|
+
| `traversePattern` | Optimizasyon sırasında hangi dosyaların taranacağını tanımlayan kalıplar. | `string[]` | `['**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}', '!**/node_modules/**', '!**/dist/**', '!**/.intlayer/**', '!**/*.config.*', '!**/*.test.*', '!**/*.spec.*', '!**/*.stories.*']` | `['src/**/*.{ts,tsx}', '../ui-library/**/*.{ts,tsx}', '!**/node_modules/**']` | • Derleme performansını artırmak için optimizasyonu ilgili dosyalarla sınırlayın.<br/>• `optimize` kapalıysa yok sayılır.<br/>• Glob kalıplarını kullanır. |
|
|
1066
1090
|
|
|
1067
1091
|
---
|
|
1068
1092
|
|
|
@@ -532,28 +532,6 @@ Varyantlar (Variants) ile birlikte kullanılan bu alan, adlandırılmış içeri
|
|
|
532
532
|
|
|
533
533
|
> Daha fazla bilgi için [Varyantlar](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dynamic_dictionaries/variants.md) sayfasına bakın.
|
|
534
534
|
|
|
535
|
-
#### `meta` (`Record<string, string | number | boolean>`)
|
|
536
|
-
|
|
537
|
-
Dinamik Kayıtlar (Dynamic Records) ile birlikte kullanılan bu alan, CMS tarafından yönetilen kayıtları veya çalışma zamanında opak bir kimlik (ID) ile getirilen rastgele verileri bildirmeyi sağlar. Sözlük kimliği, bu `meta` alanında bildirilen rastgele anahtar-değer çiftleri kümesiyle tanımlanır.
|
|
538
|
-
|
|
539
|
-
**Örnek:**
|
|
540
|
-
|
|
541
|
-
```typescript
|
|
542
|
-
{
|
|
543
|
-
key: "product-copy",
|
|
544
|
-
meta: {
|
|
545
|
-
id: "prod_abc",
|
|
546
|
-
userId: "user_123"
|
|
547
|
-
},
|
|
548
|
-
content: {
|
|
549
|
-
name: "Widget Pro",
|
|
550
|
-
description: "The best widget."
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
> Daha fazla bilgi için [Dinamik Kayıtlar](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dynamic_dictionaries/dynamic_content.md) sayfasına bakın.
|
|
556
|
-
|
|
557
535
|
### CMS Özellikleri
|
|
558
536
|
|
|
559
537
|
##### `version` (string)
|
|
@@ -87,6 +87,29 @@ JSON dosyasından içerik getirmenin bir yolu yok, bunun yerine .ts veya .js dos
|
|
|
87
87
|
|
|
88
88
|
Bu durumda, `fakeFetch` fonksiyonu sunucu yanıt süresini simüle etmek için bir gecikme taklit eder. Intlayer asenkron fonksiyonu çalıştırır ve sonucu `text` anahtarı için içerik olarak kullanır.
|
|
89
89
|
|
|
90
|
+
## Uzak İçeriği Getirme
|
|
91
|
+
|
|
92
|
+
Bir içerik alanına doğrudan bir promise de atayabilirsiniz. Intlayer, sözlükleri oluştururken bunu bekler ve çözümlenen değeri gömer:
|
|
93
|
+
|
|
94
|
+
```typescript fileName="**/*.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
|
|
95
|
+
import type { Dictionary } from "intlayer";
|
|
96
|
+
|
|
97
|
+
const remoteContent = {
|
|
98
|
+
key: "remote_content",
|
|
99
|
+
content: {
|
|
100
|
+
externalContent: fetch("https://example.com").then((res) => res.json()),
|
|
101
|
+
},
|
|
102
|
+
} satisfies Dictionary;
|
|
103
|
+
|
|
104
|
+
export default remoteContent;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```plaintext fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
108
|
+
JSON dosyasından içerik getirmenin bir yolu yok, bunun yerine .ts veya .js dosyası kullanın
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> İstek derleme zamanında çalışır, bu nedenle getirilen veri sözlüğe gömülmüş bir anlık görüntüdür. Yenilemek için sözlüklerinizi yeniden oluşturun.
|
|
112
|
+
|
|
90
113
|
## React Bileşenlerinde Fonksiyon Tabanlı İçeriği Kullanma
|
|
91
114
|
|
|
92
115
|
Bir React bileşeninde fonksiyon tabanlı içeriği kullanmak için, `react-intlayer`'dan `useIntlayer`'ı içe aktarmanız ve içeriği almak için içerik ID'si ile çağırmanız gerekir. İşte bir örnek:
|
package/docs/tr/eslint.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2026-08-12
|
|
3
|
-
updatedAt: 2026-08-
|
|
3
|
+
updatedAt: 2026-08-13
|
|
4
4
|
title: ESLint Eklentisi | Intlayer için Lint Kuralları
|
|
5
5
|
description: eslint-plugin-intlayer ile sabit kodlanmış metinleri, Intlayer derleyicisinin optimize edemediği dinamik çağrıları ve kullanılmayan sözlük içeriğini yakalayın. React, Vue, Svelte, Angular ve Astro genelinde ESLint ve oxlint ile çalışır.
|
|
6
6
|
keywords:
|
|
@@ -52,7 +52,7 @@ pnpm add --save-dev eslint-plugin-intlayer
|
|
|
52
52
|
yarn add --dev eslint-plugin-intlayer
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
ESLint 9 veya üzerini gerektirir (flat config).
|
|
55
|
+
ESLint 9 veya üzerini gerektirir (flat config). ESLint 10 desteklenir.
|
|
56
56
|
|
|
57
57
|
## Kullanım
|
|
58
58
|
|
|
@@ -61,20 +61,20 @@ Eklenti hem ESLint hem de [oxlint](https://oxc.rs) üzerinde aynı kurallar ve a
|
|
|
61
61
|
<Tabs defaultTab="eslint">
|
|
62
62
|
<Tab label="ESLint" value="eslint">
|
|
63
63
|
|
|
64
|
-
```javascript fileName="eslint.config.mjs"
|
|
64
|
+
```javascript fileName="eslint.config.mjs"
|
|
65
65
|
import intlayer from "eslint-plugin-intlayer";
|
|
66
66
|
|
|
67
67
|
export default [...intlayer.configs.recommended];
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Veya
|
|
70
|
+
Veya bir yapılandırmayı yayın ve önem düzeylerini kendiniz belirleyin:
|
|
71
71
|
|
|
72
|
-
```javascript fileName="eslint.config.mjs"
|
|
72
|
+
```javascript fileName="eslint.config.mjs"
|
|
73
73
|
import intlayer from "eslint-plugin-intlayer";
|
|
74
74
|
|
|
75
75
|
export default [
|
|
76
|
+
...intlayer.configs.recommended,
|
|
76
77
|
{
|
|
77
|
-
plugins: { intlayer },
|
|
78
78
|
rules: {
|
|
79
79
|
"intlayer/no-raw-text": "warn",
|
|
80
80
|
"intlayer/static-dictionary-key": "error",
|
|
@@ -144,7 +144,7 @@ Tüm bir dosyayı tek seferde düzeltmek için `npx intlayer extract` komutunu
|
|
|
144
144
|
|
|
145
145
|
**Seçenekler**
|
|
146
146
|
|
|
147
|
-
```javascript fileName="eslint.config.mjs"
|
|
147
|
+
```javascript fileName="eslint.config.mjs"
|
|
148
148
|
{
|
|
149
149
|
"intlayer/no-raw-text": [
|
|
150
150
|
"warn",
|
|
@@ -247,7 +247,7 @@ Diğer kuralların aksine, bu kural yalnızca önündeki dosyadan karar veremez
|
|
|
247
247
|
|
|
248
248
|
**Seçenekler**
|
|
249
249
|
|
|
250
|
-
```javascript fileName="eslint.config.mjs"
|
|
250
|
+
```javascript fileName="eslint.config.mjs"
|
|
251
251
|
{
|
|
252
252
|
"intlayer/no-unused-content": [
|
|
253
253
|
"warn",
|
|
@@ -296,7 +296,7 @@ Her kural, Vue, Svelte ve Angular şablonları dahil olmak üzere tüm Intlayer
|
|
|
296
296
|
| Angular Şablonları | `.component.html` | `@angular-eslint/template-parser` |
|
|
297
297
|
| Astro | `.astro` | `astro-eslint-parser` |
|
|
298
298
|
|
|
299
|
-
```javascript fileName="eslint.config.mjs"
|
|
299
|
+
```javascript fileName="eslint.config.mjs"
|
|
300
300
|
import intlayer from "eslint-plugin-intlayer";
|
|
301
301
|
import tseslint from "typescript-eslint";
|
|
302
302
|
import vueParser from "vue-eslint-parser";
|