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.
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
#### Workflow
- Import translations: Read all translation files and save them in the database
- Import translations: Read all translation files and save them in the
database
- Optionally: Find all translations in php/twig sources
- Optionally: Find all translations in php/twig sources
- Optionally: Log missing translations, even in a production environment
- Optionally: Log missing translations, even in a production environment
- Translate all keys through the web interface
- 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.
- Publish all translations back to the translation files or cache if in
- 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.
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
@@ -24,50 +33,120 @@ This package is used to comfortably manage, view, edit and translate Laravel lan
...
@@ -24,50 +33,120 @@ This package is used to comfortably manage, view, edit and translate Laravel lan
## Features
## Features
- import language files with options to add new translations, replace old ones or a clean start with import.
- import language files with options to add new translations, replace
- export translations from the database to language files one group at a time or all groups at once.
old ones or a clean start with import.
- 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.
- 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.
- make translations editable through a web interface.
- configurable export format for quoting, sorting of translation keys.
- 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.
- preserve multi-line comments and doc comments and empty array() values
- 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.
for first level keys on export.
- assisted translation with Yandex API integrated into the web interface that handle choice type translations and preserve replacement parameters. [Yandex Translation Supported Languages](#yandex-translation-supported-languages)
- 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
- allow editing in place of translation strings right in your web pages. This may require some rework of your blade/php view files.
- allow editing in place of translation strings right in your web pages.
- filter translations by state and regular expression pattern on keys [[Web Interface: translation filters|Web Interface#translation-filters]]
This may require some rework of your blade/php view files.
- 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|Configuration#setting-up-alternate-database-connections]]
- filter translations by state and regular expression pattern on keys
- 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.
- ability to manage translations on remote databases so that production
- import was optimized to work well, even when connecting to a remote database server.
server translation can be managed from a dev environment. See
- exported language files are formatted to align `=>` for a given level of keys, making it easier to deal with these files manually if needed.
[[Configuration: Setting up alternate database connections|Configuration#setting-up-alternate-database-connections]]
- exported language files preserve multi-line comments, doc comments and empty first level array values.
- ability to track translation group/key combinations that are used.
- added in-database translations overrides to the translations in files. Making it possible to update the site's translations without needed a new deployment.
Similar to tracking missing keys. Uses missing key lottery setting to
- 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.
minimize impact in production. Must be enabled in configuration. It is
- Translation service can be put into 'in place edit' mode that enables editing of translations where they appear on the page.
recommended that you don't make the decision solely on this mechanism
- 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.
to delete keys. It is simply a guidance not a definitive statement
- 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.
that the translation key is not used. It may only be used in some rare
- changes to database translations that have not been published show a colour coded difference between previously published/imported translations and current unpublished changes.
condition that no one encountered. However, it is a good start to
- 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.
investigate whether some cleanup is needed.
- translation page has a dash board view showing all unpublished changes, missing translations and deleted translations.
- translation manager web-interface is now fully localized. Current
- handling package translation overrides located in `resources/lang/vendor/{package}/{locale}`
version has English and Russian locales. Others can be easily added by
- 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.
adding package translation overrides in
- 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.
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.
- Yandex translation API for assisting in the translation process.
- extra buttons added to the bootstrap x-edit component for frequent operations:
- extra buttons added to the bootstrap x-edit component for frequent
- change case of translation or selection within translation: lowercase, first cap
operations:
- 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.
- 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.
- 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.
- simulated copy/paste buttons. Work only if the page is not
- 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.
reloaded and only within the translation edit dialog.
- added a working set of locales to limit number of locales displayed on the page to reduce clutter and page load time.
- 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
## Yandex Translation Supported Languages
You can find an up to date list here: <https://tech.yandex.com/translate/doc/dg/concepts/langs-docpage/>