# Translation Files Management

## Available Languages

MonoEdge Booking & Ordering is available in the following languages:

| Language | Locale Code | Status |
|----------|-------------|--------|
| English (US) | en_US | Default |
| Japanese | ja | Complete - 445 strings |
| Spanish (Spain) | es_ES | Complete - 445 strings |
| German (Germany) | de_DE | Complete - 445 strings |
| French (France) | fr_FR | Complete - 445 strings |
| Chinese (Simplified) | zh_CN | Complete - 445 strings |
| Italian (Italy) | it_IT | Complete - 287 strings |
| Portuguese (Brazil) | pt_BR | Complete - 287 strings |
| Korean | ko_KR | Complete - 287 strings |
| Dutch (Netherlands) | nl_NL | Complete - 287 strings |
| Russian | ru_RU | Complete - 287 strings |
| Turkish | tr_TR | Complete - 287 strings |
| Polish | pl_PL | Complete - 287 strings |
| Thai | th | Complete - 287 strings |
| Arabic | ar | Complete - 287 strings |
| Hindi (India) | hi_IN | Complete - 287 strings |
| Indonesian | id_ID | Complete - 287 strings |
| Vietnamese | vi | Complete - 287 strings |
| Hebrew (Israel) | he_IL | Complete - 287 strings |
| Bengali (Bangladesh) | bn_BD | Complete - 287 strings |
| Malay (Malaysia) | ms_MY | Complete - 287 strings |
| Swedish (Sweden) | sv_SE | Complete - 287 strings |
| Danish (Denmark) | da_DK | Complete - 287 strings |
| Norwegian (Bokmål) | nb_NO | Complete - 287 strings |
| Finnish | fi | Complete - 287 strings |
| Greek | el | Complete - 287 strings |
| Czech (Czech Republic) | cs_CZ | Complete - 287 strings |
| Hungarian (Hungary) | hu_HU | Complete - 287 strings |
| Romanian (Romania) | ro_RO | Complete - 287 strings |
| Ukrainian | uk | Complete - 287 strings |

## File Locations

WordPress uses translation files from two locations:

1. **`wp-content/languages/plugins/`** (Primary - WordPress default)
   - This is where WordPress looks FIRST for translation files
   - Used for production translations
   - Files: `monoedge-booking-ordering-{locale}.po` and `monoedge-booking-ordering-{locale}.mo`
   - Example: `monoedge-booking-ordering-ja.po`, `monoedge-booking-ordering-es_ES.mo`

2. **`wp-content/plugins/monoedge-booking-ordering/languages/`** (Fallback)
   - Plugin's internal translation directory
   - Used as a fallback if files are not found in the primary location
   - Contains all language files for distribution

## How to Update Translations

**IMPORTANT**: Always update BOTH locations to avoid inconsistencies.

### Step 1: Update PO Files
Edit both PO files:
- `wp-content/languages/plugins/monoedge-booking-ordering-ja.po` (PRIMARY)
- `wp-content/plugins/monoedge-booking-ordering/languages/monoedge-booking-ordering-ja.po`

### Step 2: Compile to MO Files
```bash
# Compile primary PO file
msgfmt "C:\Users\Admin\Local Sites\monoedge-booking-ordering\app\public\wp-content\languages\plugins\monoedge-booking-ordering-ja.po" -o "C:\Users\Admin\Local Sites\monoedge-booking-ordering\app\public\wp-content\languages\plugins\monoedge-booking-ordering-ja.mo"

# Compile plugin PO file
msgfmt "C:\Users\Admin\Local Sites\monoedge-booking-ordering\app\public\wp-content\plugins\monoedge-booking-ordering\languages\monoedge-booking-ordering-ja.po" -o "C:\Users\Admin\Local Sites\monoedge-booking-ordering\app\public\wp-content\plugins\monoedge-booking-ordering\languages\monoedge-booking-ordering-ja.mo"
```

### Step 3: Clear WordPress Cache
After updating translations, clear all caches:
- Object cache
- Page cache
- Browser cache (Ctrl + Shift + R)

## WordPress Translation Loading Order

WordPress checks for translation files in this order:
1. `wp-content/languages/plugins/{textdomain}-{locale}.mo` ← **PRIORITY**
2. `wp-content/plugins/{plugin-slug}/languages/{textdomain}-{locale}.mo` ← Fallback

## Text Domain
- **Text Domain**: `monoedge-booking-ordering`
- **Available Locales**: `ja`, `es_ES`, `de_DE`, `fr_FR`, `zh_CN`, `it_IT`, `pt_BR`, `ko_KR`, `nl_NL`, `ru_RU`, `tr_TR`, `pl_PL`, `th`, `ar`, `hi_IN`, `id_ID`, `vi`, `he_IL`, `bn_BD`, `ms_MY`, `sv_SE`, `da_DK`, `nb_NO`, `fi`, `el`, `cs_CZ`, `hu_HU`, `ro_RO`, `uk`
- **Domain Path**: `/languages` (defined in plugin header)

## Language File Naming Convention

Translation files follow WordPress naming convention:
- Pattern: `{textdomain}-{locale}.{extension}`
- Examples (Tier 1 - Full 445 strings):
  - Japanese: `monoedge-booking-ordering-ja.po` / `.mo`
  - Spanish: `monoedge-booking-ordering-es_ES.po` / `.mo`
  - German: `monoedge-booking-ordering-de_DE.po` / `.mo`
  - French: `monoedge-booking-ordering-fr_FR.po` / `.mo`
  - Chinese (Simplified): `monoedge-booking-ordering-zh_CN.po` / `.mo`
- Examples (Tier 2 & 3 - Core 287 strings):
  - Italian: `monoedge-booking-ordering-it_IT.po` / `.mo`
  - Portuguese (Brazil): `monoedge-booking-ordering-pt_BR.po` / `.mo`
  - Korean: `monoedge-booking-ordering-ko_KR.po` / `.mo`
  - Dutch: `monoedge-booking-ordering-nl_NL.po` / `.mo`
  - Russian: `monoedge-booking-ordering-ru_RU.po` / `.mo`
  - Turkish: `monoedge-booking-ordering-tr_TR.po` / `.mo`
  - Polish: `monoedge-booking-ordering-pl_PL.po` / `.mo`
  - Thai: `monoedge-booking-ordering-th.po` / `.mo`
  - Arabic: `monoedge-booking-ordering-ar.po` / `.mo`
  - Hindi: `monoedge-booking-ordering-hi_IN.po` / `.mo`
  - Indonesian: `monoedge-booking-ordering-id_ID.po` / `.mo`
  - Vietnamese: `monoedge-booking-ordering-vi.po` / `.mo`
  - Hebrew: `monoedge-booking-ordering-he_IL.po` / `.mo`
  - Bengali: `monoedge-booking-ordering-bn_BD.po` / `.mo`
  - Malay: `monoedge-booking-ordering-ms_MY.po` / `.mo`
  - Swedish: `monoedge-booking-ordering-sv_SE.po` / `.mo`
  - Danish: `monoedge-booking-ordering-da_DK.po` / `.mo`
  - Norwegian: `monoedge-booking-ordering-nb_NO.po` / `.mo`
  - Finnish: `monoedge-booking-ordering-fi.po` / `.mo`
  - Greek: `monoedge-booking-ordering-el.po` / `.mo`
  - Czech: `monoedge-booking-ordering-cs_CZ.po` / `.mo`
  - Hungarian: `monoedge-booking-ordering-hu_HU.po` / `.mo`
  - Romanian: `monoedge-booking-ordering-ro_RO.po` / `.mo`
  - Ukrainian: `monoedge-booking-ordering-uk.po` / `.mo`

## Troubleshooting

If translations don't appear:
1. Verify both PO and MO files exist in primary location (`wp-content/languages/plugins/`)
2. Check MO file timestamp (must be newer than PO file)
3. Clear all WordPress caches
4. Hard refresh browser (Ctrl + Shift + R)
5. Check plugin's `load_plugin_textdomain()` call in `monoedge-booking-ordering.php:63`

## Best Practices

1. ✅ **DO**: Always update the PRIMARY location first (`wp-content/languages/plugins/`)
2. ✅ **DO**: Keep both locations synchronized
3. ✅ **DO**: Compile MO files after every PO file change
4. ❌ **DON'T**: Edit only one location - this causes inconsistencies
5. ❌ **DON'T**: Forget to compile MO files - WordPress only reads MO files, not PO files
