Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Potrans Laravel Package

om/potrans

Laravel package for managing translations with import/export tools and a simple UI/API. Helps keep language files in sync, edit keys/values, detect missing strings, and streamline localization workflows across your app.

View on GitHub
Deep Wiki
Context7

Command line tool for translate Gettext with Google Translator API or DeepL API

Frequently asked questions about Potrans
How does om/potrans integrate with Laravel’s built-in translation system (Lang facade)?
om/potrans doesn’t natively replace Laravel’s Lang facade or translation cache. It works alongside Laravel by managing .po/.mo files, which you’d need to manually sync with Laravel’s `resources/lang` directory. For full integration, you’d need a custom `LoaderInterface` (e.g., `GettextLoader`) to bridge Laravel’s translation system with the .mo files generated by potrans.
Can I use om/potrans with Laravel’s JSON/array-based translations, or is it only for .po/.mo files?
om/potrans is optimized for Gettext (.po/.mo) files and won’t directly work with Laravel’s JSON/array translations. If you rely on JSON, you’d need to export/import translations manually or use potrans for externalized strings (e.g., third-party content) while keeping Laravel’s native format for app-specific translations.
What Laravel versions does om/potrans support, and are there Symfony version conflicts?
om/potrans requires Symfony Console ^7.0|^8.0, but Laravel 10+ uses Symfony 6.4. This creates a high risk of dependency conflicts. If you’re on Laravel 10+, test thoroughly in a staging environment or isolate potrans in a separate directory to avoid breaking core functionality.
How do I scan my Laravel app for missing translation keys and sync them to .po files?
Use the `potrans scan` command to detect unused keys in your codebase, then run `potrans update` to sync missing entries to your .pot/.po files. Example: `./vendor/bin/potrans scan resources/lang/messages.pot --output=resources/lang --lang=de`. This requires xgettext to be installed for parsing PHP source files.
Does om/potrans work with Laravel’s translation cache, or will I need to manually clear it?
om/potrans doesn’t invalidate Laravel’s translation cache automatically. After updating .po/.mo files, manually clear the cache with `php artisan cache:clear` or `php artisan view:clear` if using Blade translations. For CI/CD, add these commands post-translation to ensure consistency.
Can I use om/potrans in CI/CD to auto-translate strings via Google/DeepL APIs?
Yes, but you’ll need to configure API keys in your CI environment (e.g., GitHub Secrets) and run commands like `./vendor/bin/potrans google resources/lang/messages.pot --lang=de --force`. Monitor API quotas and rate limits, as unexpected costs can occur if not managed.
What’s the best way to handle API failures (e.g., DeepL rate limits) in a production workflow?
om/potrans doesn’t include built-in retry logic for API failures. To mitigate this, implement a wrapper script in your CI/CD pipeline that retries failed commands or falls back to a local cache. Example: Use `retry-cli` or a custom Bash loop to re-run `potrans` with exponential backoff.
How do I structure my Laravel project to use om/potrans alongside native translations?
Store Gettext files (e.g., `.po/.mo`) in a separate directory like `resources/gettext/` and use a custom `LoaderInterface` to load them. For Laravel’s native translations, keep `resources/lang/` as-is. Sync changes between the two directories manually or via a post-deploy script.
Are there alternatives to om/potrans for Laravel that support JSON translations natively?
Yes, consider packages like `spatie/laravel-translatable` (for database-driven translations) or `laravel-lang/lang` (for JSON-based localization). These integrate directly with Laravel’s Lang facade and avoid Gettext’s file-based workflow, making them easier to maintain in pure Laravel projects.
How do I test om/potrans in a Laravel project before deploying to production?
Start by testing in a staging environment with a subset of translations. Use `php artisan tinker` to verify translations load correctly after running `potrans`. Mock API responses in tests (e.g., with `vcr` for DeepL/Google) to avoid real API calls. Validate edge cases like plural forms and RTL languages.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata