Skip to content

Automated Localization Management with GitHub Actions #20

@NiKrause

Description

@NiKrause

Description

We're experiencing issues with localizations in DoiWallet where translations are either lost or missing after changes, particularly in files like /loc/de_de.json. We need an automated solution to manage and maintain our localizations.

Proposed Solution

Implement a GitHub Action that monitors and manages localizations automatically.

Workflow Overview

  1. Monitor changes in base localization files (en.json and de_de.json)
  2. Compare all other localization files against these base files
  3. Automatically identify missing or obsolete translations
  4. Use AI translation API to generate missing translations
  5. Create PR with suggested updates

Technical Implementation Draft

name: Localization Sync
on:
   push:
    paths:
     'loc/en.json'
     'loc/de_de.json'
    branches:
main
develop
jobs:
sync-localizations:
runs-on: ubuntu-latest
steps:
uses: actions/checkout@v3
name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
name: Install dependencies
run: npm install
name: Run localization sync
env:
AI_TRANSLATION_API_KEY: ${{ secrets.AI_TRANSLATION_API_KEY }}
run: node scripts/sync-localizations.js
```javascript
members
This issue template provides a comprehensive overview of the problem and a proposed solution with technical implementation details. It can be customized further based on specific project needs and requirements.

Required Components

  1. Base Script (scripts/sync-localizations.js)

    async function syncLocalizations() {
      // 1. Load base files (en.json and de_de.json)
      const englishBase = require('../loc/en.json');
      const germanBase = require('../loc/de_de.json');
      
      // 2. Get all localization files
      const locFiles = fs.readdirSync('../loc');
      
      // 3. For each localization file:
      //    - Compare against base files
      //    - Identify missing keys
      //    - Request AI translations for missing entries
      //    - Update files
      
      // 4. Create PR with changes if needed
    }
  2. Translation Service Integration

    • Integration with OpenAI API or similar for automated translations
    • Quality assurance checks for generated translations
    • Fallback mechanisms for failed translations
  3. Reporting System

    • Generate reports of missing translations
    • List of automated translations added
    • Statistics on translation coverage

Success Criteria

  • No manual intervention required for basic translation updates
  • All localization files maintain consistent structure
  • Missing translations are automatically added
  • Obsolete translations are identified and removed
  • Translation quality meets minimum standards
  • Clear reporting of changes made

Notes

  • Need to decide on preferred AI translation service
  • Consider rate limits and costs of translation API
  • May need human review process for critical translations
  • Consider implementing translation memory to reduce API calls

Labels

  • automation
  • localization
  • github-actions
  • enhancement

/cc @relevant-team-members

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions