First, let’s verify what translation files you have in your source language (e.g., English).
ls lang/en/
You should see files like:
auth.phpvalidation.phpmessages.php
2
Review Your Source Translation File
Let’s look at an example source file lang/en/messages.php:
lang/en/messages.php
<?phpreturn [ 'welcome' => 'Welcome to our application', 'goodbye' => 'Thank you for using our service', 'notifications' => [ 'new_message' => 'You have a new message', 'account_updated' => 'Your account has been updated', ], 'errors' => [ 'not_found' => 'The requested resource was not found', 'unauthorized' => 'You are not authorized to access this resource', ],];
3
Run Your First Translation
Now let’s translate the messages.php file to Spanish. Run:
AI TranslatorSource: enLanguages: esDomains: messagesTranslating from en to es: messages5 missing keys found: welcome, goodbye, notifications.new_message, notifications.account_updated, errors.not_found, errors.unauthorizedTranslating in 1 chunks... (attempt #1 of 3)████████████████████ 100%Generated translations for messages from en to es:welcome: "Bienvenido a nuestra aplicación"goodbye: "Gracias por usar nuestro servicio"notifications.new_message: "Tienes un nuevo mensaje"notifications.account_updated: "Tu cuenta ha sido actualizada"errors.not_found: "El recurso solicitado no fue encontrado"errors.unauthorized: "No estás autorizado para acceder a este recurso"Writing translations for messages from en to es
4
Verify the Generated File
Check the newly created Spanish translation file:
cat lang/es/messages.php
The generated file will look like:
lang/es/messages.php
<?phpreturn [ 'welcome' => 'Bienvenido a nuestra aplicación', 'goodbye' => 'Gracias por usar nuestro servicio', 'notifications' => [ 'new_message' => 'Tienes un nuevo mensaje', 'account_updated' => 'Tu cuenta ha sido actualizada', ], 'errors' => [ 'not_found' => 'El recurso solicitado no fue encontrado', 'unauthorized' => 'No estás autorizado para acceder a este recurso', ],];
5
Validate Your Translations
Finally, validate that all keys have been translated:
This uses a faster LLM model, which is useful for:
Large translation files
Development/testing environments
Non-customer-facing content
The --fast flag trades some translation quality for speed. For production use, we recommend running without this flag to ensure the highest quality translations.