Skip to content

PR-1: API Translation.io Integration & Configuration #84

@kevalyq

Description

@kevalyq

📌 Parent Epic

#83

🎯 Goal

Integrate Translation.io into the Laravel API backend to enable multi-language support. This includes installing the package, configuring environment variables, setting up locales (en, de), and optionally adding the locale middleware to API routes.

📋 Implementation Tasks

  • Install tio/laravel package via Composer
  • Create config/translation.php with API key from environment
  • Add TRANSLATIONIO_KEY placeholder to .env.example
  • Configure actual API key in .env (not committed)
  • Set source_locale to en and target_locales to ['de']
  • Configure gettext_parse_paths to include ['app', 'resources']
  • Add Translation.io locale middleware to routes/api.php (optional, evaluate necessity)
  • Run php artisan translation:init to initialize Translation.io sync
  • Add Translation.io credit to README.md (required for Open Source plan)
  • Update CHANGELOG.md with entry in [Unreleased] → Added section
  • All tests passing
  • PHPStan and Pint checks passing
  • Documentation in README about translation workflow

✅ Acceptance Criteria

  • Translation.io package installed and configured
  • Environment variables properly set (placeholder in example, actual key in .env)
  • API key stored securely in .env, not in version control
  • php artisan translation:init executed successfully
  • Translation.io dashboard shows project synced
  • README includes mention of Translation.io (Open Source plan requirement)
  • All tests passing (≥80% coverage maintained)
  • PHPStan level max passing
  • Laravel Pint passing
  • CHANGELOG.md updated
  • No breaking changes to existing API endpoints
  • LOC count ≤ 600 (excluding lock files, or marked with large-pr-approved label if needed)

🔗 Dependencies

  • Depends on: Translation.io account setup (✓ completed)
  • Blocks: #TBD (Frontend implementation - requires API to be ready first)

📝 Technical Notes

  • Package: tio/laravel (https://github.com/translation/laravel)
  • API Key: 0ebce5906cb64a93bbd845cf7925a4ae (store in .env as TRANSLATIONIO_KEY)
  • Configuration File: config/translation.php
  • Locales:
    • Source: en (English)
    • Target: de (German)
  • Gettext Paths: ['app', 'resources'] - scans these directories for translatable strings
  • Middleware: Translation.io provides a set.locale middleware - evaluate if needed for API routes
  • Open Source Plan Requirements:
    • Public repository (✓ already public)
    • Mention Translation.io in README

🧪 Testing Strategy

  • Verify configuration loads correctly
  • Test that php artisan translation:init completes without errors
  • Ensure no existing functionality is broken
  • Verify Translation.io dashboard receives initial sync
  • Test locale switching (if middleware is added)

📝 PR Linking Instructions

When creating the PR for this sub-issue, use this in your PR description:

Fixes #<this-sub-issue-number>
Part of: #83

⚠️ Important:

  • Do NOT use Fixes #83 - this is not the last sub-issue
  • The epic should only close when the frontend implementation is also complete

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions