Metadata-Version: 2.1
Name: jupyterlab-translate
Version: 1.2.0
Summary: JupyterLab Language Pack Translations Helper
Project-URL: homepage, https://github.com/jupyterlab/jupyterlab-translate
Author-email: Project Jupyter Contributors <jupyter@googlegroups.com>
License: Copyright (c) 2020 Project Jupyter Contributors
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE.txt
Keywords: hatch,jupyterlab,language,localization
Classifier: Framework :: Hatch
Classifier: Framework :: Jupyter
Classifier: Framework :: Jupyter :: JupyterLab
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Requires-Dist: babel
Requires-Dist: click
Requires-Dist: cookiecutter
Requires-Dist: crowdin-api-client
Requires-Dist: hatchling>=1.5
Requires-Dist: importlib-metadata>=4.8.3; python_version < '3.10'
Requires-Dist: polib
Requires-Dist: requests
Provides-Extra: test
Requires-Dist: check-manifest; extra == 'test'
Requires-Dist: hatch; extra == 'test'
Requires-Dist: pre-commit; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Description-Content-Type: text/markdown

# jupyterlab-translate

![Linux tests](https://github.com/jupyterlab/jupyterlab-translate/workflows/Run%20tests/badge.svg)
[![license](https://img.shields.io/pypi/l/jupyterlab-translate.svg)](./LICENSE.txt)
[![pypi version](https://img.shields.io/pypi/v/jupyterlab-translate.svg)](https://pypi.org/project/jupyterlab-translate/)
[![conda version](https://img.shields.io/conda/vn/conda-forge/jupyterlab-translate.svg)](https://www.anaconda.org/conda-forge/jupyterlab-translate)
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Join the chat at https://gitter.im/jupyterlab/jupyterlab](https://badges.gitter.im/jupyterlab/jupyterlab.svg)](https://gitter.im/jupyterlab/jupyterlab)

This package is used to generate [language packs](https://github.com/jupyterlab/language-packs) for the JupyterLab ecosystem.

This package performs the following tasks common on JupyterLab core and external extensions:

* Extract strings from code in `*.py`, `*.ts`, `*.tsx` files.
* Extract strings from JSON schema files.
* Create gettext `*.pot` catalogs.
* Removes duplicate strings from catalogs.
* Create gettext `*.po` catalogs for specific languages.
* Compile catalogs to `*.mo` and `*.json` format to be consumed by the JupyterLab frontend.
* Provide a [Hatch Build Hook](https://hatch.pypa.io/latest/plugins/build-hook/reference/) to compile catalogs when building wheels.
* Update the list of contributors from Crowdin project.

## Installation

### Pip

```bash
pip install jupyterlab-translate
```

You will also need to install `nodejs` >= 14.

### Conda

```bash
conda install jupyterlab-translate -c conda-forge
```

## Usage

### Bundle catalogs as part of a language pack

This is the recommended way of distributing your localization catalogs.

Visit the [language packs repository](https://github.com/jupyterlab/language-packs).

### Bundle catalogs with packages

```bash
jupyterlab-translate extract <JLAB-EXTENSION-DIR> <JLAB-EXTENSION-NAME>
jupyterlab-translate update <JLAB-EXTENSION-DIR> <JLAB-EXTENSION-NAME> -l es-ES
jupyterlab-translate compile <JLAB-EXTENSION-DIR> <JLAB-EXTENSION-NAME>
```

## Development

### Typescript extractor

To extract translatable strings from typescript files, this package relies on
[`gettext-extract`](https://github.com/sinedied/gettext-extract). To ease its
installation and usage, that tool is packaged within the python package by
creating a monolithic JavaScript file using [`@vercel/ncc`](https://github.com/vercel/ncc)
_compiler_.

To update the monolithic file, have a look at the [release file](./RELEASE.md).
