Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jannesblobel committed Feb 18, 2023
1 parent 586c7ef commit 1e3271e
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,33 @@ Use a .pot file in your project. It is easier to manage the ids in a file instea
*/
export async function defineConfig(env) {
// importing plugin from local file for testing purposes
const plugin = await env.$import("../dist/index.js");
const plugin = await env.$import("https://cdn.jsdelivr.net/gh/jannesblobel/inlang-plugin-po@1/dist/index.js");

const pluginConfig = {
// language mean the name of you file
pathPattern: "./example/{language}.po",
// Replace pathPattern with the path where your languages are stored.
pathPattern: "./example/locale/{language}/LC_MESSAGES/django.po",

// Your referenceResourcePath could be
// null or "./example/locale/en/LC_MESSAGES/django.pot",
// dependent if you use pot file as you referenceLanguage
referenceResourcePath: null,
};

return {
Ff your project uses a pot file, use it as a reference language.
// !! do not include the .pot file in the Languages array
/**
* @example
* example files: en.pot, de.po, es.po, fr.po
* referenceLanguage: "en",
languages: ["de","es","fr"],
*/
// it is necessary to add a referenceLanguage even if referenceResourcePath = null
referenceLanguage: "en",
languages: ["de","es","fr"],
languages: await plugin.getLanguages({
referenceLanguage: "en",
...env,
pluginConfig,
}),
readResources: (args) =>
plugin.readResources({ ...args, ...env, pluginConfig }),
writeResources: (args) =>
plugin.writeResources({ ...args, ...env, pluginConfig }),
};
}

```

For additional usage information, take a look at [example](./example/).
Expand Down

0 comments on commit 1e3271e

Please sign in to comment.