-
Notifications
You must be signed in to change notification settings - Fork 84
Configuration 4.2
The config file app/config/packages/laravel-translation-manager/config.php
has comments that
provide a description for each option. Note that when admin_enabled
is set to false then
translation management is limited to editing existing translations all other operations have to
be done through the command line. Ideally, this option needs to be dynamic based on user
privileges so that translators cannot delete translations or administer translations but admins
can. See Installation 4.2: step 8.
By default the primary locale is en
. The primary locale determines what language is used for
the source text for the translate button in the edit pop-up and can be changed in the web
interface for the current session. When editing the text for the primary locale a button in the
edit pop-up allows you to convert the text of the key to a default value (change . - _ to
spaces, capitalize first letter of each word) that way you can generate descent placeholder text
to continue development and replace it with more meaningful value later.
By default the configuration will load all translations found in the standard Laravel locations. In the table below {vendor}, {package}, {locale}, {group} are placeholders for their corresponding values referring to vendor name, package name, locale string and translation group. The translation group will consist of optional sub-directory tree and the file name, allowing you to organize your translation files.
/app/lang/{locale}/{group}.php
: Standard project translation files
/app/lang/packages/{locale}/{package}/{group}
: Package translation override files.
/workbench/{vendor}/{package}/src/lang/{locale}/{group}
: Translation files for packages that you are developing in the current project.
/vendor/{vendor}/{package}/src/lang/{locale}/{group}
: Translation files for packages that are dependents of your project. By default no
translation files are loaded from this section. You will need to edit the configuration file
for the 'vendor' section and list the packages you want to include in the 'include' array in
the form 'vendor/package'. These will have a group prefix of vnd:
in the database and web
interface to distinguish them from the standard Laravel package namespaces
The default configuration file also has entries for two packages whose translation files'
location and naming convention does not follow Laravel conventions and require more tweaking to
allow import/export of their language files. These non-standard layouts can only be included in
the wbn:
or vnd:
prefixed namespaces.
If you published the views to your project in
Installation 4.2: step 11 then you can customize them to your
liking. The package view directory also contains a layouts/master.blade.php
file for a default
layout. The intent is for you to provide your own master layout that the index.blade.php will
extend so it can match your site's style.
If you want to be able to access multiple databases for the translation manager from one set of
language files you can configure the db_connections
option in the config file. Here is what I
use to access the production server's translations from my local development environment:
/**
* @type array list of alternate database connections with
* their properties indexed by app()->environment() value,
* default connection settings are taken from config,
* so only add alternate connections
*
* description is used to display the connection name,
* default connection is displayed as 'default' in
* the web interface.
*/
'db_connections' => array(
'local' => array(
'mysql_prd' => array(
'description' => 'production',
'indatabase_publish' => 2,
),
),
),
The option is an array of environment names which in turn contain database connection names which list the options to use for that connection.
description
: the string to use in the web interface combo box to represent this connection. If the
description is empty or missing then the connection name will be used.
indatabase_publish
: the setting for indatabase_publish
to use for this connection. If this option is missing
then the global configuration indatabase_publish
will be used. Setting this value to 2,
will write to the local translation files but leave the database in a state to serve changed
translations from the cache. Note that with indatabase_publish
set to 1 or 2 publishing
will not reset the changed flag for translations and these will continue to show up in the
dashboard as changed
.
-
After updating the remote translations you need to go into translations page on the remote server and do a
publish all
so that either the files or the cache is updated with new translations. -
After deploying a new version of the application, with updated translation files on the servers, you should do an
Import
withOnly add new translations
. This will import any new translations and reset the cache.