|
| 1 | +# Translation Guide for Flowify |
| 2 | + |
| 3 | +## How to Add a New Language |
| 4 | + |
| 5 | +Adding a new language to Flowify is straightforward! Follow these simple steps: |
| 6 | + |
| 7 | +### 1. Edit `translations.js` |
| 8 | + |
| 9 | +Open the `translations.js` file and locate the `translations` object. |
| 10 | + |
| 11 | +### 2. Add Your Language Object |
| 12 | + |
| 13 | +Copy the entire English (`en`) translation object and paste it with your new language code. For example, to add Spanish: |
| 14 | + |
| 15 | +```javascript |
| 16 | +const translations = { |
| 17 | + en: { /* ... existing English translations ... */ }, |
| 18 | + fr: { /* ... existing French translations ... */ }, |
| 19 | + |
| 20 | + // Add Spanish |
| 21 | + es: { |
| 22 | + // Welcome screen |
| 23 | + welcome: "Bienvenido a Flowify", |
| 24 | + welcomeSubtitle: "Tu reproductor de música que respeta tu privacidad", |
| 25 | + selectLanguage: "Selecciona tu idioma", |
| 26 | + enterName: "¿Cómo deberíamos llamarte?", |
| 27 | + namePlaceholder: "Tu nombre", |
| 28 | + letsGo: "¡Vamos!", |
| 29 | + |
| 30 | + // ... translate all other keys ... |
| 31 | + } |
| 32 | +}; |
| 33 | +``` |
| 34 | + |
| 35 | +### 3. Update Supported Languages |
| 36 | + |
| 37 | +Add your language to the `supportedLanguages` array: |
| 38 | + |
| 39 | +```javascript |
| 40 | +const supportedLanguages = [ |
| 41 | + { code: 'en', name: 'English', flag: '🇬🇧' }, |
| 42 | + { code: 'fr', name: 'Français', flag: '🇫🇷' }, |
| 43 | + { code: 'es', name: 'Español', flag: '🇪🇸' } // Add this line |
| 44 | +]; |
| 45 | +``` |
| 46 | + |
| 47 | +### 4. Add Language Button to Welcome Screen |
| 48 | + |
| 49 | +Open `index.html` and find the language selector section. Add a new button: |
| 50 | + |
| 51 | +```html |
| 52 | +<div class="language-selector"> |
| 53 | + <button class="language-btn active" data-lang="en" onclick="selectLanguage('en')"> |
| 54 | + <span class="flag">🇬🇧</span> |
| 55 | + <span>English</span> |
| 56 | + </button> |
| 57 | + <button class="language-btn" data-lang="fr" onclick="selectLanguage('fr')"> |
| 58 | + <span class="flag">🇫🇷</span> |
| 59 | + <span>Français</span> |
| 60 | + </button> |
| 61 | + <!-- Add your new language --> |
| 62 | + <button class="language-btn" data-lang="es" onclick="selectLanguage('es')"> |
| 63 | + <span class="flag">🇪🇸</span> |
| 64 | + <span>Español</span> |
| 65 | + </button> |
| 66 | +</div> |
| 67 | +``` |
| 68 | + |
| 69 | +## Translation Keys Reference |
| 70 | + |
| 71 | +Here's a quick reference of what each translation key is used for: |
| 72 | + |
| 73 | +### Welcome Screen |
| 74 | +- `welcome` - Main welcome title |
| 75 | +- `welcomeSubtitle` - Subtitle text |
| 76 | +- `selectLanguage` - Language selection label |
| 77 | +- `enterName` - Name input label |
| 78 | +- `namePlaceholder` - Placeholder for name input |
| 79 | +- `letsGo` - Submit button text |
| 80 | + |
| 81 | +### Navigation |
| 82 | +- `navHome`, `navSearch`, `navPlaylists`, `navSettings` - Navigation menu items |
| 83 | + |
| 84 | +### Player Controls |
| 85 | +- `play`, `pause`, `previous`, `next` - Playback buttons |
| 86 | +- `shuffle`, `repeat`, `repeatOne`, `repeatOff` - Player modes |
| 87 | +- `volume`, `mute`, `unmute` - Volume controls |
| 88 | + |
| 89 | +### Playlists |
| 90 | +- `createPlaylist`, `deletePlaylist`, `editPlaylist` - Playlist actions |
| 91 | +- `addToPlaylist`, `removeFromPlaylist` - Track management |
| 92 | +- `likedSongs` - Special playlist name |
| 93 | +- `offline` - Offline indicator |
| 94 | + |
| 95 | +### Settings |
| 96 | +- `theme`, `darkTheme`, `lightTheme` - Theme options |
| 97 | +- `audioQuality` - Quality settings section |
| 98 | +- `discordRPC` - Discord integration |
| 99 | +- `storage` - Storage management |
| 100 | +- `customTheme` - Custom theme editor |
| 101 | + |
| 102 | +### Messages |
| 103 | +- `trackDownloaded`, `trackLiked`, `trackUnliked` - User feedback |
| 104 | +- `error`, `success` - Generic messages |
| 105 | + |
| 106 | +### Greetings |
| 107 | +- `greeting.morning`, `greeting.afternoon`, `greeting.evening`, `greeting.night` - Time-based greetings |
| 108 | + |
| 109 | +## Tips for Translators |
| 110 | + |
| 111 | +1. **Keep the tone consistent** - Flowify is friendly and casual |
| 112 | +2. **Respect placeholders** - Don't translate technical terms like "Discord RPC" or file types |
| 113 | +3. **Test your translations** - Make sure they fit in the UI without breaking layout |
| 114 | +4. **Consider context** - Some words may need different translations based on where they appear |
| 115 | +5. **Use native speakers** - If possible, have a native speaker review your translations |
| 116 | + |
| 117 | +## Testing Your Translation |
| 118 | + |
| 119 | +1. Clear your browser's localStorage to trigger the welcome screen |
| 120 | +2. Select your new language |
| 121 | +3. Navigate through all sections of the app |
| 122 | +4. Check that all text is properly translated |
| 123 | +5. Verify that buttons, labels, and messages display correctly |
| 124 | + |
| 125 | +## Need Help? |
| 126 | + |
| 127 | +If you're adding a new language and need assistance, feel free to open an issue on GitHub! |
0 commit comments