Metadata-Version: 2.1
Name: translations-util
Version: 0.1.0
Summary: Command line tools for extracting and importing translations from and to excel files
Author: Marius Holter Berntzen
Author-email: mhberntzen@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: colorama (>=0.4.6,<0.5.0)
Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
Requires-Dist: pandas (>=2.2.3,<3.0.0)
Description-Content-Type: text/markdown

# translations-util

Command line tools for extracting and importing translations from and to Excel files.

## Installation

To install the dependencies for this project, use [Poetry](https://python-poetry.org/):

```sh
poetry install
```

## Usage

This tool allows you to update translations in a TypeScript file based on an Excel file. The Excel file should contain the translations in a specific format.

### Command Line Usage

```sh
python update_translations.py <excel_file> <language_sheet> <ts_file>
```

- `<excel_file>`: Path to the Excel file containing the translations.
- `<language_sheet>`: Name of the sheet in the Excel file that contains the translations.
- `<ts_file>`: Path to the TypeScript file to be updated.

### Example

```sh
python update_translations.py translations.xlsx French translations.ts
```

This command will update the `translations.ts` file with the French translations from the `translations.xlsx` file.

## Excel File Format

The Excel file should have at least three columns:
1. **Key**: The key for the translation.
2. **English Text**: The original English text.
3. **Translation**: The translated text.

## Features

- **Placeholder Matching**: Ensures that placeholders in the format `{variable}` are consistent between the English text and the translation.
- **Translation Blocks**: Detects and processes translation blocks marked by `// TODO: vvv Translate below vvv` and `// TODO: ^^^ Translate above ^^^`.

## Development

To contribute to this project, clone the repository and install the dependencies using Poetry:

```sh
git clone <repository-url>
cd translations-util
poetry install
```

## License

This project is licensed under the MIT License.

