Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Update inlang.config.js (#1359)

Nils Jacobsenf577522fe173
diff --git a/docs/docs/content/i18n.md b/docs/docs/content/i18n.md
index 63348123..e8829e54 100644
--- a/docs/docs/content/i18n.md
+++ b/docs/docs/content/i18n.md
@@ -27,6 +27,8 @@ To customize an existing language or to load a new language, put one or more `.j
### Using InLang (external service)
+[![translation badge](https://inlang.com/badge?url=github.com/knadh/listmonk)](https://inlang.com/editor/github.com/knadh/listmonk?ref=badge)
+
- Visit [https://inlang.com/editor/github.com/knadh/listmonk](https://inlang.com/editor/github.com/knadh/listmonk)
- To make changes and push them, you need to log in to GitHub using OAuth and fork the project from the UI.
- Translate the text in the input fields on the UI. You can use the filters to see only the necessary translations.
diff --git a/inlang.config.js b/inlang.config.js
index 4ad81f87..7bc8d5be 100644
--- a/inlang.config.js
+++ b/inlang.config.js
@@ -1,34 +1,17 @@
-/**
- * See https://inlang.com/documentation
- */
export async function defineConfig(env) {
- const plugin = await env.$import(
- "https://cdn.jsdelivr.net/gh/samuelstroschein/inlang-plugin-json@1/dist/index.js"
- );
+ const { default: pluginJson } = await env.$import(
+ 'https://cdn.jsdelivr.net/gh/samuelstroschein/[email protected]/dist/index.js'
+ );
- const pluginConfig = {
- pathPattern: "./i18n/{language}.json",
- };
+ const { default: standardLintRules } = await env.$import(
+ 'https://cdn.jsdelivr.net/gh/inlang/standard-lint-rules@2/dist/index.js'
+ );
- return {
- referenceLanguage: "en",
- languages: await getLanguages(env),
- readResources: (args) =>
- plugin.readResources({ ...args, ...env, pluginConfig }),
- writeResources: (args) =>
- plugin.writeResources({ ...args, ...env, pluginConfig }),
- };
+ return {
+ referenceLanguage: 'en',
+ plugins: [pluginJson({
+ pathPattern: './i18n/{language}.json',
+ variableReferencePattern: ["{", "}"]
+ }), standardLintRules()]
+ };
}
-
-
-/**
- * Automatically derives the languages in this repository.
- */
-async function getLanguages(env) {
- // replace the path
- const files = await env.$fs.readdir("./i18n");
- // files that end with .json
- // remove the .json extension to only get language name
- const languages = files.filter((name) => name.endsWith(".json")).map((name) => name.replace(".json", ""));
- return languages;
-}
\ No newline at end of file