Skip to content

feat: traduction automatique FR→EN des pages pagecontent via Albert IA#34

Open
nriss wants to merge 2 commits into
mainfrom
feature/albert-translation
Open

feat: traduction automatique FR→EN des pages pagecontent via Albert IA#34
nriss wants to merge 2 commits into
mainfrom
feature/albert-translation

Conversation

@nriss

@nriss nriss commented May 29, 2026

Copy link
Copy Markdown
Member

Description des changements

  • Ajout de l'input translate dans action.yml : false (défaut) / true (nouvelles pages uniquement) / force (tout retraduire)
  • Ajout de l'input albert_api_key dans action.yml : à renseigner avec le secret ALBERT_WORKFLOW_KEY depuis le workflow appelant
  • Ajout de 5 steps de traduction dans action.yml, placés avant le lancement de l'IG Publisher (après sushi) pour que les pages soient disponibles lors de la génération HTML :
    1. Setup Python 3.11
    2. Installation de httpx
    3. Synchronisation des fichiers .po (translations/en/po/input/translations/en/)
    4. Appel de l'API Albert pour traduire les .md de input/pagecontent/ vers input/translations/en/pagecontent/
    5. Commit + push des traductions dans le repo de l'IG
  • Ajout du script tools/translate_pages.py (appelé via ${{ github.action_path }}/tools/translate_pages.py)

Utilisation

- uses: ansforge/IG-workflows@main
  with:
    repo_ig: "./igSource"
    github_page: "true"
    github_page_token: ${{ secrets.GITHUB_TOKEN }}
    translate: "true"           # false | true | force
    albert_api_key: ${{ secrets.ALBERT_WORKFLOW_KEY }}

…via Albert IA

Deux nouveaux inputs dans action.yml :
- translate : false (défaut) / true (nouvelles pages) / force (tout retraduire)
- albert_api_key : clé API Albert à passer depuis le workflow appelant (ALBERT_WORKFLOW_KEY)

Les steps de traduction s'exécutent entre sushi et le publisher, garantissant
que les pages traduites sont disponibles lors de la génération HTML.

Ajout du script tools/translate_pages.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread action.yml
if: ${{ inputs.translate == 'true' || inputs.translate == 'force' }}
shell: bash
run: |
SRC="${{ inputs.repo_ig }}/translations/en/po"
Comment thread action.yml
shell: bash
run: |
SRC="${{ inputs.repo_ig }}/translations/en/po"
DEST="${{ inputs.repo_ig }}/input/translations/en"
Comment thread action.yml
ALBERT_API_KEY: ${{ inputs.albert_api_key }}
run: |
FORCE_FLAG=""
if [ "${{ inputs.translate }}" = "force" ]; then
Comment thread action.yml
FORCE_FLAG="--force"
fi
python ${{ github.action_path }}/tools/translate_pages.py \
--source-dir "${{ inputs.repo_ig }}/input/pagecontent" \
Comment thread action.yml
fi
python ${{ github.action_path }}/tools/translate_pages.py \
--source-dir "${{ inputs.repo_ig }}/input/pagecontent" \
--target-dir "${{ inputs.repo_ig }}/input/translations/en/pagecontent" \
Comment thread action.yml
if: ${{ inputs.translate == 'true' || inputs.translate == 'force' }}
shell: bash
run: |
cd ${{ inputs.repo_ig }}
…ERT_WORKFLOW_KEY

La clé API Albert n'est plus un paramètre explicite de l'action.
L'action lit directement la variable d'environnement ALBERT_WORKFLOW_KEY,
gérée au niveau de l'organisation ansforge. Les IGs appelants n'ont pas
à connaître ni à configurer cette clé.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

2 participants