# WooCommerce Tier and Package Prices - Translations

This directory contains translation files for the WooCommerce Tier and Package Prices plugin.

## Available Languages

- **English (US)** - `en_US` - Default language
- **German (Germany)** - `de_DE` - Deutsch

## File Structure

```
languages/
├── README.md                               # This file
├── wc-tier-package-prices.pot             # Translation template (3.1 KB)
├── wc-tier-package-prices-en_US.po        # English source file
├── wc-tier-package-prices-en_US.mo        # English compiled file (2.9 KB)
├── wc-tier-package-prices-de_DE.po        # German source file
└── wc-tier-package-prices-de_DE.mo        # German compiled file (3.0 KB)
```

## File Types

- **`.pot`** - Portable Object Template - Master template file for creating new translations
- **`.po`** - Portable Object - Human-readable translation source file
- **`.mo`** - Machine Object - Compiled binary file used by WordPress

## Adding a New Translation

### Method 1: Using Poedit (Recommended)

1. Download and install [Poedit](https://poedit.net/)
2. Open Poedit and click "Create new translation"
3. Select the `wc-tier-package-prices.pot` file
4. Choose your language
5. Translate all strings
6. Save the file (this creates both `.po` and `.mo` files automatically)
7. Name the files as `wc-tier-package-prices-{locale}.po` and `wc-tier-package-prices-{locale}.mo`
   - Example for French: `wc-tier-package-prices-fr_FR.po` and `wc-tier-package-prices-fr_FR.mo`

### Method 2: Using Command Line

1. Copy the POT file to create a new PO file:
   ```bash
   cp wc-tier-package-prices.pot wc-tier-package-prices-fr_FR.po
   ```

2. Edit the PO file header:
   ```
   "Language: fr_FR\n"
   "Language-Team: French\n"
   "Plural-Forms: nplurals=2; plural=(n > 1);\n"
   ```

3. Translate all `msgstr` entries in the PO file

4. Compile the PO file to MO:
   ```bash
   msgfmt -o wc-tier-package-prices-fr_FR.mo wc-tier-package-prices-fr_FR.po
   ```

## WordPress Locale Codes

Common locale codes for WordPress:

- `en_US` - English (United States)
- `en_GB` - English (United Kingdom)
- `de_DE` - German (Germany)
- `de_CH` - German (Switzerland)
- `fr_FR` - French (France)
- `fr_CH` - French (Switzerland)
- `es_ES` - Spanish (Spain)
- `it_IT` - Italian (Italy)
- `nl_NL` - Dutch (Netherlands)
- `pt_BR` - Portuguese (Brazil)
- `ru_RU` - Russian
- `zh_CN` - Chinese (Simplified)
- `ja` - Japanese

For a complete list, see: https://translate.wordpress.org/

## Translation Statistics

### English (en_US)
- **Total strings**: 30
- **Translated**: 30 (100%)
- **Status**: ✅ Complete

### German (de_DE)
- **Total strings**: 30
- **Translated**: 30 (100%)
- **Status**: ✅ Complete

## Translatable Strings

The plugin contains translations for:

### Admin Interface
- Settings page titles and descriptions
- Product meta box labels
- Field labels and placeholders
- Button text

### Frontend
- Pricing table headers
- Package selection buttons
- Cart notifications
- Discount displays

## Testing Translations

### 1. Install Translation Files

Upload the `.mo` file to one of these locations:
- Plugin directory: `wp-content/plugins/wc-tier-and-package-prices/languages/`
- WordPress languages directory: `wp-content/languages/plugins/`

### 2. Change WordPress Language

1. Go to **Settings > General**
2. Set **Site Language** to your desired language
3. Save changes

### 3. Verify Translation

1. Navigate to **WooCommerce > Tier & Package Prices**
2. Edit a product and check the meta boxes
3. View a product on the frontend
4. Check the cart page

All text should appear in the selected language.

## Updating Existing Translations

When the plugin is updated with new strings:

1. Update the POT template file
2. Open your PO file in Poedit
3. Click **Catalog > Update from POT file**
4. Select the new `wc-tier-package-prices.pot` file
5. Translate any new strings
6. Save (automatically compiles to MO)

## Command Line Compilation

If you prefer command-line tools:

```bash
# Compile a single language
msgfmt -o wc-tier-package-prices-de_DE.mo wc-tier-package-prices-de_DE.po

# Compile all languages at once
for po in *.po; do
    msgfmt -o "${po%.po}.mo" "$po"
done

# Verify MO file
msgunfmt wc-tier-package-prices-de_DE.mo | less
```

## Translation Guidelines

### Style Guide

1. **Consistency**: Use consistent terminology throughout
2. **Context**: Consider the context where text appears (admin vs frontend)
3. **Length**: Keep translations similar in length to the original
4. **Formality**: Maintain appropriate level of formality for your language
5. **Technical Terms**: Don't translate technical terms like "WooCommerce"

### German Translation Notes

- Uses formal "Sie" form (not informal "du")
- Currency examples adjusted (€ instead of $)
- Decimal separator uses comma (9,99 instead of 9.99)
- Date format: DD.MM.YYYY

### Best Practices

- ✅ Translate user-facing strings
- ✅ Keep HTML tags intact
- ✅ Preserve placeholders like `%s`, `%d`
- ✅ Maintain the same number of placeholders
- ❌ Don't translate variable names
- ❌ Don't translate code or CSS classes
- ❌ Don't remove or add HTML tags

## Contributing Translations

To contribute a new translation:

1. Create the PO and MO files following the guidelines above
2. Test thoroughly in a WordPress installation
3. Submit via pull request or contact the developer
4. Include:
   - Both PO and MO files
   - Your name/credits for attribution
   - Screenshot showing the translation in use

## Support

For translation-related questions or to request a new language:

- **Plugin URI**: https://src.bundespruefstelle.ch/wc-tier-package-prices
- **Author**: Marco Graetsch
- **Author URI**: https://src.bundespruefstelle.ch/magdev

## Credits

### Translators

- **English (en_US)**: Marco Graetsch
- **German (de_DE)**: Marco Graetsch

### Translation Tools

- [Poedit](https://poedit.net/) - Cross-platform PO editor
- [Loco Translate](https://wordpress.org/plugins/loco-translate/) - WordPress plugin for translations
- [GNU gettext](https://www.gnu.org/software/gettext/) - Command-line tools

## License

Translation files are distributed under the same GPL v2 or later license as the plugin.
