1
- /**
2
- * See https://inlang.com/documentation
3
- */
4
1
export async function defineConfig ( env ) {
5
- const plugin = await env . $import (
6
- " https://cdn.jsdelivr.net/gh/samuelstroschein/inlang-plugin-json@1/dist/index.js"
7
- ) ;
2
+ const { default : pluginJson } = await env . $import (
3
+ ' https://cdn.jsdelivr.net/gh/samuelstroschein/inlang-plugin-json@2.3. 1/dist/index.js'
4
+ ) ;
8
5
9
- const pluginConfig = {
10
- pathPattern : "./i18n/{language}.json" ,
11
- } ;
6
+ const { default : standardLintRules } = await env . $import (
7
+ 'https://cdn.jsdelivr.net/gh/inlang/standard-lint-rules@2/dist/index.js'
8
+ ) ;
12
9
13
- return {
14
- referenceLanguage : "en" ,
15
- languages : await getLanguages ( env ) ,
16
- readResources : ( args ) =>
17
- plugin . readResources ( { ...args , ...env , pluginConfig } ) ,
18
- writeResources : ( args ) =>
19
- plugin . writeResources ( { ...args , ...env , pluginConfig } ) ,
20
- } ;
10
+ return {
11
+ referenceLanguage : 'en' ,
12
+ plugins : [ pluginJson ( {
13
+ pathPattern : './i18n/{language}.json' ,
14
+ variableReferencePattern : [ "{" , "}" ]
15
+ } ) , standardLintRules ( ) ]
16
+ } ;
21
17
}
22
-
23
-
24
- /**
25
- * Automatically derives the languages in this repository.
26
- */
27
- async function getLanguages ( env ) {
28
- // replace the path
29
- const files = await env . $fs . readdir ( "./i18n" ) ;
30
- // files that end with .json
31
- // remove the .json extension to only get language name
32
- const languages = files . filter ( ( name ) => name . endsWith ( ".json" ) ) . map ( ( name ) => name . replace ( ".json" , "" ) ) ;
33
- return languages ;
34
- }
0 commit comments