Home - vsch/laravel-translation-manager GitHub Wiki

This package is used to comfortably manage, view, edit and translate Laravel language files with translation assistance through the Yandex Translation API. It augments the Laravel Translator system with a ton of practical functionality.

Workflow

  • Import translations: Read all translation files and save them in the database
  • Optionally: Find all translations in php/twig sources
  • Optionally: Log missing translations, even in a production environment
  • Translate all keys through the web interface
  • Publish all translations back to the translation files or cache if in production environment where writing of files is not an option.
  • Optionally: Download zipped translations. The zip archive will contain the files that would be exported to the resources/lang directory so it is easy to replace translations on your development system without being able to write files in production or connect your development system to the production database.

Translation Manager Screenshot

React App UI as an alternative to WebUI

React_UI

Table of Contents

Features

  • import language files with options to add new translations, replace old ones or a clean start with import.
  • export translations from the database to language files one group at a time or all groups at once.
  • download a zip archive of the translations in the database as if the translations were exported to files and then the resources/lang directory was zipped.
  • make translations editable through a web interface.
  • configurable export format for quoting, sorting of translation keys.
  • preserve multi-line comments and doc comments and empty array() values for first level keys on export.
  • allow in-database translations to override the ones in the language files. Used to update translations on server clusters where updating translation files is not possible (like AWS EC2) or would cause server code to be out of sync.
  • assisted translation with Yandex API integrated into the web interface that handle choice type translations and preserve replacement parameters. Yandex Translation Supported Languages
  • auto-translate empty translations.
  • allow editing in place of translation strings right in your web pages. This may require some rework of your blade/php view files.
  • filter translations by state and regular expression pattern on keys Web Interface: translation filters
  • ability to manage translations on remote databases so that production server translation can be managed from a dev environment. See Configuration: Setting up alternate database connections
  • ability to track translation group/key combinations that are used. Similar to tracking missing keys. Uses missing key lottery setting to minimize impact in production. Must be enabled in configuration. It is recommended that you don't make the decision solely on this mechanism to delete keys. It is simply a guidance not a definitive statement that the translation key is not used. It may only be used in some rare condition that no one encountered. However, it is a good start to investigate whether some cleanup is needed.
  • translation manager web-interface is now fully localized. Current version has English and Russian locales. Others can be easily added by adding package translation overrides in app/lang/vendor/laravel-translation-manager/{locale}/messages.php files and generating a pull request so that they could be incorporated into the package.
  • import was optimized to work well, even when connecting to a remote database server.
  • exported language files are formatted to align => for a given level of keys, making it easier to deal with these files manually if needed.
  • exported language files preserve multi-line comments, doc comments and empty first level array values.
  • added in-database translations overrides to the translations in files. Making it possible to update the site's translations without needed a new deployment.
  • publishing translations on production systems where updating translation files would only update a single server, can be configured to use the cache for serving up the modified translations. This allows translations to be updated live without having to redeploy a new version of the language files.
  • Translation service can be put into 'in place edit' mode that enables editing of translations where they appear on the page.
    • this eliminates the need to peruse code to find the translation group/key combination that is used for the resulting string and then looking for it in the translation files or in the web interface. Simply enable in-place editing mode and click on the errant string you wish to edit.
    • This functionality may require some editing of view files to handle: string values that should not be links because they are not shown or are used for HTML attribute values, <button> contents that don't display links and other edge cases.
  • changes to database translations that have not been published show a colour coded difference between previously published/imported translations and current unpublished changes.
  • soft delete of translations that can be undone until translations are published eliminating the annoyance of either a confirmation for every delete or an Oh! S--t, I hit the wrong key.
  • translation page has a dash board view showing all unpublished changes, missing translations and deleted translations.
  • handling package translation overrides located in resources/lang/vendor/{package}/{locale}
  • handling of translation files in subdirectories both the resources/lang/{locale}/ and package override translations in resources/lang/vendor/{package}/{locale} to allow managing package translation overrides.
  • missing translation key logging that can be used in a production environment by setting 1 of N sessions to actually log missing translations. Since checking for missing translation requires hitting the database for every translation, it can be a heavy load on the DB server. This configuration setting allows randomly selecting 1 of N user sessions to be marked as checking for missing translations allowing the benefit of finding missing translations while reducing the load burden on the server.
  • in place edit mode inside the search dialog to allow editing of translation in the search result.
  • Yandex translation API for assisting in the translation process.
  • extra buttons added to the bootstrap x-edit component for frequent operations:
    • change case of translation or selection within translation: lowercase, first cap
    • create plural forms for use in choice(), currently English is automatically created and Russian will do its best by using Yandex translator to derive the plural forms.
    • recall translation text from last saved or last published.
    • simulated copy/paste buttons. Work only if the page is not reloaded and only within the translation edit dialog.
  • moved the delete translation icon before the translation key instead of after the last translation because for large number of locales it was impossible to know which key was going to be marked for deletion.
  • added a working set of locales to limit number of locales displayed on the page to reduce clutter and page load time.

Yandex Translation Supported Languages

You can find an up to date list here: https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/

Language Locale Language Locale Language Locale
Azerbaijan az Spanish es Cebuano ceb
Albanian sq Kazakh kk Serbian sr
Amharic am Kannada kn Sinhala si
English en Catalan ca Slovakian sk
Arabic ar Kyrgyz ky Slovenian sl
Armenian hy Chinese zh Swahili sw
Afrikaans af Korean ko Sundanese su
Basque eu Xhosa xh Tajik tg
Bashkir ba Latin la Thai th
Belarusian be Latvian lv Tagalog tl
Bengali bn Lithuanian lt Tamil ta
Bulgarian bg Malagasy mg Tatar tt
Bosnian bs Malay ms Telugu te
Welsh cy Malayalam ml Turkish tr
Hungarian hu Maltese mt Udmurt udm
Vietnamese vi Macedonian mk Uzbek uz
Haitian (Creole) ht Maori mi Ukrainian uk
Galician gl Marathi mr Urdu ur
Dutch nl Mari mhr Finnish fi
Hill Mari mrj Mongolian mn French fr
Greek el German de Hindi hi
Georgian ka Nepali ne Croatian hr
Gujarati gu Norwegian no Czech cs
Danish da Punjabi pa Swedish sv
Hebrew he Papiamento pap Scottish gd
Yiddish yi Persian fa Estonian et
Indonesian id Polish pl Esperanto eo
Irish ga Portuguese pt Javanese jv
Italian it Romanian ro Japanese ja
Icelandic is Russian ru
⚠️ **GitHub.com Fallback** ⚠️