Skip to content

Commit

Permalink
Add Inlang to enable community translations / make the contribution o…
Browse files Browse the repository at this point in the history
…f translations easier (jazzband#662)

* init inlang.config.js

The inlang config has to exist at the root of the repository. See opral/monorepo#258.

* init th en. pot file

* Create po file as reference language. Add instead of a pot file

* remove whitespace right after LC_MESSAGES.

* update config and remove en files

* update inlang config

* Update README.rst

* fix title underline

* Update README.rst

---------

Co-authored-by: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com>
  • Loading branch information
jannesblobel and Andrew-Chen-Wang authored Jan 28, 2023
1 parent b959771 commit e67944a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ Framework <http://www.django-rest-framework.org/>`__.

For full documentation, visit `django-rest-framework-simplejwt.readthedocs.io
<https://django-rest-framework-simplejwt.readthedocs.io/en/latest/>`__.


Translations
------------

Contribute translations directly with PRs or via inlang https://inlang.com/editor/github.com/jazzband/djangorestframework-simplejwt
47 changes: 47 additions & 0 deletions inlang.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// filename: inlang.config.js

export async function defineConfig(env) {
// importing a plugin
const plugin = await env.$import(
"https://cdn.jsdelivr.net/gh/jannesblobel/inlang-plugin-po@1/dist/index.js"
);

// most plugins require additional config, read the plugins documentation
// for the required config and correct usage.
const pluginConfig = {
pathPattern:
"./rest_framework_simplejwt/locale/{language}/LC_MESSAGES/django.po",
referenceResourcePath: null,
};

return {
referenceLanguage: "en",
languages: [
"en",
"cs",
"de",
"es",
"es_AR",
"es_CL",
"fa_IR",
"fr",
"id_ID",
"it_IT",
"ko_KR",
"nl_NL",
"pl_PL",
"pt_BR",
"ro",
"ru_RU",
"sl",
"sv",
"tr",
"uk_UA",
"zh_Hans",
],
readResources: (args) =>
plugin.readResources({ ...args, ...env, pluginConfig }),
writeResources: (args) =>
plugin.writeResources({ ...args, ...env, pluginConfig }),
};
}

0 comments on commit e67944a

Please sign in to comment.