# GTM4Publishers Translations

This directory contains translation files for the GTM4Publishers plugin.

## Included Files

- `gtm4publishers.pot` - Translation template file
- `gtm4publishers-en_GB.po` - English translation (Great Britain)
- `gtm4publishers-en_GB.mo` - Compiled file for English
- `gtm4publishers-es_ES.po` - Spanish translation
- `gtm4publishers-es_ES.mo` - Compiled file for Spanish
- `gtm4publishers-ru_RU.po` - Russian translation
- `gtm4publishers-ru_RU.mo` - Compiled file for Russian

## How to Use Translations

### For Users

1. **Automatic Installation**: Translations are loaded automatically according to the language configured in WordPress.

2. **Default Language**: If no translation is available for your language, the plugin will be displayed in Spanish.

### For Translators

#### Creating a New Translation

1. Copy the `gtm4publishers.pot` file and rename it with the corresponding language code:
   ```bash
   cp gtm4publishers.pot gtm4publishers-es_ES.po
   ```

2. Edit the `.po` file with a translation editor such as:
   - Poedit (https://poedit.net/)
   - Lokalize (KDE)
   - Gtranslator (GNOME)

3. Translate all text strings

4. Compile the `.mo` file:
   ```bash
   msgfmt gtm4publishers-es_ES.po -o gtm4publishers-es_ES.mo
   ```

#### Updating Existing Translations

1. Update the POT file with new strings:
   ```bash
   xgettext --from-code=UTF-8 --keyword=__ --keyword=_e --keyword=esc_html__ --keyword=esc_html_e --keyword=esc_attr__ --keyword=esc_attr_e --keyword=_x --keyword=esc_html_x --keyword=esc_attr_x --add-comments=translators: --output=gtm4publishers.pot *.php
   ```

2. Update existing PO files:
   ```bash
   msgmerge --update gtm4publishers-en_US.po gtm4publishers.pot
   ```

3. Translate new strings and compile:
   ```bash
   msgfmt gtm4publishers-en_US.po -o gtm4publishers-en_US.mo
   ```

## Supported Language Codes

- `en_GB` - English (Great Britain)
- `es_ES` - Spanish (Spain)
- `ru_RU` - Russian (Russia)

## Contributing with Translations

If you want to contribute with a translation:

1. Create a fork of the repository
2. Add your translation file
3. Send a pull request

Or contact us at: https://t.me/GTM4Publishers

## Technical Notes

- **Textdomain**: `gtm4publishers`
- **Domain Path**: `/languages`
- **Encoding**: UTF-8
- **Format**: GNU gettext (PO/MO)

## Translation Functions Used

The plugin uses the following WordPress functions for internationalization:

- `__()` - For strings that are returned
- `_e()` - For strings that are printed directly
- `esc_html__()` - For strings that are returned with HTML escaping
- `esc_html_e()` - For strings that are printed with HTML escaping
- `esc_attr__()` - For strings that are returned with attribute escaping
- `esc_attr_e()` - For strings that are printed with attribute escaping

All functions include the `'gtm4publishers'` textdomain to ensure translations are applied correctly. 