Skip to content

[Translate] Add Agent translation - #28

Merged
rrr63 merged 1 commit into
1.xfrom
translate
Dec 1, 2025
Merged

rrr63 merged 1 commit into
1.xfrom
translate

Conversation

@rrr63

@rrr63 rrr63 commented Dec 1, 2025

Copy link
Copy Markdown
Member

This PR to add a native Doppar translation, that works inside /lang/{lang} folder :
Multiple ways to translate using AI :

translate any content between two langages

 Agent::using($agent)
   ->withKey($apiKey)
   ->model($model)
   ->translate($langFrom, $langTo, $content);

auto translate all Doppar translate folder (/lang/{lang} folder)

Inside controller using your own agent

Agent::using($agent)
   ->withKey($apiKey)
   ->model($model)
   ->translateLocalization($langFrom, $langTo); //this will create the new folder with all files translated

using the ai:translate command :

php pool ai:translate gemini fr br
# this will ask you for your apikey
# ai:translate {agent} {langFrom} {langTo} {model?}
# only gemini and openai supported yet

results with popular langages

en to fr:

<?php

return [
    'default' => 'Les données fournies ne sont pas valides.',
    'required' => 'Le champ :attribute est obligatoire',
    'exists_in' => 'La valeur sélectionnée pour :attribute est invalide.',
    'email' => 'Le champ :attribute doit être une adresse email valide.',
    'min' => [
        'string' => 'Le champ :attribute doit contenir au moins :min caractères.',
    ],

results with local langages

fr to oc:

<?php

return [
    'default' => 'Las donadas provesidas son pas validas.',
    'required' => 'Lo camp :attribute es obligatòri',
    'exists_in' => 'La valor seleccionada per :attribute es invalida.',
    'email' => 'Lo camp :attribute deu èsser una adreça email valida.',
    'min' => [
        'string' => 'Lo camp :attribute deu contenir al mens :min caractèrs.',
    ],
    'max' => [
        'string' => 'Lo camp :attribute deu pas depassar :max caractèrs.',
    ],

@rrr63
rrr63 merged commit 2de1c3e into 1.x Dec 1, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant