File: /var/www/test.kaunokolegija.lt/kk_wp_content/plugins/events/languages/README.md
# Kauno Events Plugin - Internationalization (i18n)
This directory contains the language files for the Kauno Events Plugin admin interface.
## Supported Languages
- **English (en_US)** - Default language
- **Lithuanian (lt_LT)** - Lithuanian translations
## File Structure
```
languages/
├── kauno-events-admin-en_US.po # English source file
├── kauno-events-admin-en_US.mo # English compiled file
├── kauno-events-admin-lt_LT.po # Lithuanian source file
├── kauno-events-admin-lt_LT.mo # Lithuanian compiled file
└── README.md # This file
```
## How It Works
The plugin uses WordPress's built-in internationalization system:
1. **Text Domain**: `kauno-events`
2. **Loading**: The text domain is loaded in the `init()` method of the main plugin class
3. **Usage**: All translatable strings use the `__()` or `_e()` functions with the text domain
## Adding New Translations
### 1. Create a new .po file
Create a new .po file for your language (e.g., `kauno-events-admin-de_DE.po` for German):
```bash
# Copy the English file as a template
cp kauno-events-admin-en_US.po kauno-events-admin-de_DE.po
```
### 2. Update the header
Change the language header in your new .po file:
```
"Language: de_DE\n"
```
### 3. Translate the strings
Replace the English `msgstr` values with your translations:
```
msgid "Add New Event"
msgstr "Neues Event hinzufügen"
```
### 4. Compile the .mo file
Use the msgfmt tool to compile your .po file:
```bash
msgfmt kauno-events-admin-de_DE.po -o kauno-events-admin-de_DE.mo
```
## Adding New Strings
When adding new translatable strings to the plugin:
1. Use the `__()` function for strings that return a value
2. Use the `_e()` function for strings that are echoed
3. Always include the text domain: `__('Your string', 'kauno-events')`
Example:
```php
$title = __('Event Title', 'kauno-events');
_e('Save Event', 'kauno-events');
```
## Updating Existing Translations
To update translations when new strings are added:
1. Extract all translatable strings from the source code
2. Update the .po files with new entries
3. Recompile the .mo files
## WordPress Language Detection
WordPress will automatically detect the user's language preference and load the appropriate translation file. The plugin supports:
- **English (en_US)**: Default fallback
- **Lithuanian (lt_LT)**: Full translation
## Technical Notes
- **Text Domain**: `kauno-events`
- **Load Path**: `dirname(plugin_basename(__FILE__)) . "/languages"`
- **Plural Forms**:
- English: `nplurals=2; plural=(n != 1);`
- Lithuanian: `nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);`
## Files Translated
The following admin files have been internationalized:
- `admin/add-event.php` - Event creation/editing form
- `admin/events-list.php` - Events management list
- `admin/submissions.php` - Event submissions management
- `kauno-events-plugin.php` - Main plugin file (admin menu items)
## Testing Translations
To test translations:
1. Change your WordPress language in Settings > General
2. Or use a language switcher plugin
3. Navigate to the Events admin pages
4. Verify that all strings are properly translated
## Contributing
To contribute translations:
1. Fork the plugin repository
2. Create or update the appropriate .po file
3. Compile the .mo file
4. Submit a pull request with both .po and .mo files