# Broker for Boat – Languages

This folder contains translation files for the `broker-for-boat` plugin.

## Files
- broker-for-boat.pot              → Template with all translatable strings
- broker-for-boat-es_ES.po|.mo     → Spanish (Spain)
- broker-for-boat-en_US.po|.mo     → English (US)
- broker-for-boat-ca_CA.po|.mo     → Catalan (Catalonia)
- broker-for-boat-fr_FR.po|.mo     → French (France)

## How to update translations
1. Update the POT file (optional)
   - Use a tool like Loco Translate, WP-CLI i18n, Poedit, or `xgettext` to refresh `broker-for-boat.pot`.
2. Edit the PO files
   - Open the `.po` in Poedit (or your preferred editor) and translate the missing strings.
3. Compile MO files
   - Compile `.po` to `.mo` so WordPress can load them automatically.

### Compile with msgfmt (GNU gettext)
```bash
msgfmt -o broker-for-boat-es_ES.mo broker-for-boat-es_ES.po
msgfmt -o broker-for-boat-en_US.mo broker-for-boat-en_US.po
msgfmt -o broker-for-boat-ca_CA.mo broker-for-boat-ca_CA.po
msgfmt -o broker-for-boat-fr_FR.mo broker-for-boat-fr_FR.po
```

Place the resulting `.mo` files in this same `languages/` directory.

## WordPress loading
The plugin loads the textdomain with:
```
load_plugin_textdomain('broker-for-boat', false, basename(BROKER_FOR_BOAT_PLUGIN_DIR) . '/languages/');
```
WordPress will pick the `.mo` file that matches the current locale (e.g. `es_ES`, `fr_FR`).

## Fallback runtime translations
If `.mo` files are missing, the plugin includes a light runtime fallback in `includes/i18n/bfb-l10n.php` that translates the most important strings (modal, single labels, PDF) for ES/EN/CA/FR.

## Adding a new language
1. Duplicate `broker-for-boat-en_US.po` and rename it to your locale (e.g. `broker-for-boat-it_IT.po`).
2. Translate the strings.
3. Compile to `broker-for-boat-it_IT.mo` and place it here.
