toolforge-i18n


Nametoolforge-i18n JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryA library for making Toolforge tools written in Python translatable.
upload_time2024-10-03 16:36:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords i18n toolforge translation wikimedia
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # toolforge_i18n

**toolforge_i18n** is a library for making Wikimedia Toolforge tools written in Python translatable.
It’s especially geared towards Flask-based tools,
but should also be usable with other frameworks.

<!-- The entire next section is also included in docs/index.rst; keep them in sync. -->

## Features

- Make your tool translatable into dozens,
  potentially hundreds of languages!

- Easy integration with [translatewiki.net][]
  by reusing MediaWiki message file syntax.

- Full support for the [magic words][]
  `{{GENDER:}}` and `{{PLURAL:}}`,
  as well as for hyperlink syntax (`[url text]`)
  and list formatting.

- By default, support for a MediaWiki-like
  `?uselang=` URL parameter,
  including `?uselang=qqx` to see message keys.

- Correct conversion between MediaWiki language codes
  and HTML language codes / IETF BCP 47 language tags;
  for instance, `?uselang=simple` produces `<html lang="en-simple">`.

- Correct `lang=` and `dir=` in the face of language fallback:
  messages that (due to language fallback) don’t match the surrounding markup
  are automatically wrapped in a `<span>` with the right attributes.
  (Even MediaWiki doesn’t do this!
  Though, admittedly, MediaWiki doesn’t have the luxury of assuming
  that every message can be wrapped in a `<span>` –
  many MediaWiki messages are block elements that would rather need a `<div>`.)

- Includes checks to ensure all translations are safe,
  without unexpected elements (e.g. `<script>`)
  or attributes (e.g. `onclick=`),
  to protect against XSS attacks from translations.
  The tests are automatically registered via a pytest plugin
  and also run at tool initialization time.

## How to use it

See the [documentation](https://toolforge-i18n.readthedocs.io/en/latest/),
especially [the documentation for Flask tools](https://toolforge-i18n.readthedocs.io/en/latest/flask/index.html)
or [for non-Flask tools](https://toolforge-i18n.readthedocs.io/en/latest/other.html)
depending on which framework you use.

Please note that the library is still relatively new
and has not been used by many tools yet.
If anything is unclear or there are problems,
feel free to reach out to the maintainer(s)
and/or [file a task on Phabricator](https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?project=toolforge_i18n).

## License

BSD-3-Clause.

[translatewiki.net]: https://translatewiki.net/
[magic words]: https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Magic_words
[pip-tools]: https://pip-tools.readthedocs.io/en/latest/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "toolforge-i18n",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "i18n, toolforge, translation, wikimedia",
    "author": null,
    "author_email": "Lucas Werkmeister <mail@lucaswerkmeister.de>",
    "download_url": "https://files.pythonhosted.org/packages/a9/f2/1ab0f040a837f1f8998178bf9640278f4c94d0056d5c4bae8e899c40740f/toolforge_i18n-0.1.1.tar.gz",
    "platform": null,
    "description": "# toolforge_i18n\n\n**toolforge_i18n** is a library for making Wikimedia Toolforge tools written in Python translatable.\nIt\u2019s especially geared towards Flask-based tools,\nbut should also be usable with other frameworks.\n\n<!-- The entire next section is also included in docs/index.rst; keep them in sync. -->\n\n## Features\n\n- Make your tool translatable into dozens,\n  potentially hundreds of languages!\n\n- Easy integration with [translatewiki.net][]\n  by reusing MediaWiki message file syntax.\n\n- Full support for the [magic words][]\n  `{{GENDER:}}` and `{{PLURAL:}}`,\n  as well as for hyperlink syntax (`[url text]`)\n  and list formatting.\n\n- By default, support for a MediaWiki-like\n  `?uselang=` URL parameter,\n  including `?uselang=qqx` to see message keys.\n\n- Correct conversion between MediaWiki language codes\n  and HTML language codes / IETF BCP 47 language tags;\n  for instance, `?uselang=simple` produces `<html lang=\"en-simple\">`.\n\n- Correct `lang=` and `dir=` in the face of language fallback:\n  messages that (due to language fallback) don\u2019t match the surrounding markup\n  are automatically wrapped in a `<span>` with the right attributes.\n  (Even MediaWiki doesn\u2019t do this!\n  Though, admittedly, MediaWiki doesn\u2019t have the luxury of assuming\n  that every message can be wrapped in a `<span>` \u2013\n  many MediaWiki messages are block elements that would rather need a `<div>`.)\n\n- Includes checks to ensure all translations are safe,\n  without unexpected elements (e.g. `<script>`)\n  or attributes (e.g. `onclick=`),\n  to protect against XSS attacks from translations.\n  The tests are automatically registered via a pytest plugin\n  and also run at tool initialization time.\n\n## How to use it\n\nSee the [documentation](https://toolforge-i18n.readthedocs.io/en/latest/),\nespecially [the documentation for Flask tools](https://toolforge-i18n.readthedocs.io/en/latest/flask/index.html)\nor [for non-Flask tools](https://toolforge-i18n.readthedocs.io/en/latest/other.html)\ndepending on which framework you use.\n\nPlease note that the library is still relatively new\nand has not been used by many tools yet.\nIf anything is unclear or there are problems,\nfeel free to reach out to the maintainer(s)\nand/or [file a task on Phabricator](https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?project=toolforge_i18n).\n\n## License\n\nBSD-3-Clause.\n\n[translatewiki.net]: https://translatewiki.net/\n[magic words]: https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Magic_words\n[pip-tools]: https://pip-tools.readthedocs.io/en/latest/\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A library for making Toolforge tools written in Python translatable.",
    "version": "0.1.1",
    "project_urls": {
        "Documentation": "https://toolforge-i18n.readthedocs.io/en/latest/",
        "Issues": "https://phabricator.wikimedia.org/tag/toolforge_i18n/",
        "Source": "https://gitlab.wikimedia.org/lucaswerkmeister/toolforge_i18n/"
    },
    "split_keywords": [
        "i18n",
        " toolforge",
        " translation",
        " wikimedia"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "309b4e1e34a04c932dd89df0f5e3ceedb487f1a76b87c36dcd3138f6bbf004cc",
                "md5": "7a86ca6d8cd51537cd819523881af61a",
                "sha256": "4cf5b32354f8c369948e360a8742e3d92f9e37f02dbd778226df977e11e19a0f"
            },
            "downloads": -1,
            "filename": "toolforge_i18n-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7a86ca6d8cd51537cd819523881af61a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 24532,
            "upload_time": "2024-10-03T16:36:01",
            "upload_time_iso_8601": "2024-10-03T16:36:01.178225Z",
            "url": "https://files.pythonhosted.org/packages/30/9b/4e1e34a04c932dd89df0f5e3ceedb487f1a76b87c36dcd3138f6bbf004cc/toolforge_i18n-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a9f21ab0f040a837f1f8998178bf9640278f4c94d0056d5c4bae8e899c40740f",
                "md5": "b2fd3f4499990d39ff42622c14dd9a01",
                "sha256": "f7546c1f6d817a4de690ab02608785492686ef2eea07e4f0a04bcfc308ad0ad6"
            },
            "downloads": -1,
            "filename": "toolforge_i18n-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b2fd3f4499990d39ff42622c14dd9a01",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 35230,
            "upload_time": "2024-10-03T16:36:02",
            "upload_time_iso_8601": "2024-10-03T16:36:02.351682Z",
            "url": "https://files.pythonhosted.org/packages/a9/f2/1ab0f040a837f1f8998178bf9640278f4c94d0056d5c4bae8e899c40740f/toolforge_i18n-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-03 16:36:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "toolforge-i18n"
}
        
Elapsed time: 0.72203s