Main menu

Optional settings for the Loco Translate plugin

The following options are available across the plugin's usage by every user that has access. Settings are saved as WordPress site options, so they take effect per site where the plugin is available.

Extracting strings

These options are observed when extracting translatable strings to generate templates.

  • Skip PHP files larger than [size] (default 100K)
    Setting the maximum size of a PHP file can avoid memory usage problems. Files larger than this limit will not be scanned for strings. Try lowering this value if you hit a memory limit, but raise it if files containing required strings are skipped.

    This option takes a value in PHP shorthand style, e.g. "50K" for kilobytes, "1M" for megabytes or "2048" for an exact number of bytes.

  • Scan PHP files with extensions (default: php twig)
    When extracting strings from PHP source code, Loco Translate will look only in files with these extensions. Loco Translate 2.0.16 added support for Twig templates, but note that only the PHP syntax used by Timber is currently supported.

  • Scan JavaScript files with extensions (default: none)
    Experimental feature: Loco Translate 2.2.0 added support for JavaScript string extraction. Add extensions such as "js" to enable this. The rules are exactly the same as for PHP: JavaScript files must use standard WordPress l10n functions and specify text domains.

Saving PO/POT files

  • Number of backups to keep of each file (default: 1)
    This option specifies the number of previous revisions to keep when a PO or POT file is updated. The default is 1, meaning every save action creates a new backup and deletes any older backups. Switching this to 0 disables backups completely.

    Currently you can only restore backups manually by accessing the file system over FTP or SSH. The format for a backup file name is <filename>-backup-<timestamp>.<extension>~

  • Maximum line length (default: 79)
    This number controls the line wrapping (or page width) of all newly written PO and POT files.
    Set this value to 0 (zero) to disable line wrapping completely.

  • Add UTF-8 byte order mark (default: off)
    This option causes Loco Translate to prepend a 3 byte UTF-8 BOM to all newly written PO and POT files.
    We don't recommended you enable this option, unless you need it for compatibility with other editing software.

  • Enable Ajax file uploads (default: on)
    This changes how the file editor posts PO files to your server. When enabled the source is sent as a concrete file upload. When disabled, the file source is sent as if it were a form field. It's recommended to enable file uploads because long form fields can cause problems with some security software. If you have problems uploading files to your server then try disabling this option.

Syncing PO files

  • Fuzzy matching tolerance (default: 20%)
    This option specifies how to treat redundant strings when a sync operation drops them from existing PO files. The higher the value the more likely a string will be kept. Switching this option to 0 (zero) disables fuzzy matching completely.

  • Sync with source when template missing (default: warn)
    If a POT file is missing Loco Translate can sync directly to the source code. This is not recommended so by default you will be warned. Use this option to either suppress the warnings (allow) or prevent direct syncing completely (disallow).

Compiling MO files

These options control how Loco compiles binary MO files from your PO translation files.

  • Generate hash tables (default: off)
    By default hash tables are not generated because WordPress doesn't use them. This keeps MO files smaller. If you intend to use your MO files in other software that requires hash tables for looking up strings, then enable this option.

  • Include fuzzy strings (default: on)
    Loco compiles Fuzzy strings into MO files by default, but it's common practice to leave them out. Fuzzy strings may be incorrect, so switch this option off if you'd rather English is displayed when a translation could be wrong.

Compiling JSON files

These options control how Loco compiles JSON language packs from your PO translation files.

  • Pretty formatting (default: off)
    This formats the JSON to make it human readable. It's equivalent to --pretty-print in the wp i18n make-json command.

  • Delete redundant files (default: off)
    This cleans up old JSON files that are no longer used. You may find some language packs contain hundreds of files due to this problem. This option is disabled by default because it destroys data, but it's safe to enable as long as you're not relying on redundant JSON files for some reason.

File system access

  • Save credentials in session (default: off)
    This option saves you entering FTP or SSH credentials every time you need to connect to the remote server via the Loco Translate UI. It is disabled by default for security reasons and we recommend you don't use it unless you understand the risks. See the section on remote file system access.

    Logging out destroys your session in the WordPress database and any stored credentials along with it.

  • Modification of installed files (default: warn)
    By default you will be warned before you modify any part of the file system that could be overwritten or deleted during a WordPress update. The loosest setting ("allow") suppresses warnings, while the strictest setting ("disallow") blocks all write operations to potentially sensitive files. See the section on installed files.

  • Editing of POT (template) files (default: warn)
    Loco Translate provides manual editing and syncing of POT files, but it's not uncommon for people to accidentally enter translations and break their templates. The default setting of this option warns against doing so. The loosest setting ("allow") suppresses warnings, while the strictest setting ("disallow") blocks all write operations to POT files.

Grant access to roles

This section gives you basic control over which WordPress roles have access to Loco Translate pages.

Every role to which you grant access will have full access to the functions of Loco Translate including saving and deleting files. This is done through a single WordPress capability called loco_admin.

If the translator role doesn't already exist, it will be created automatically. This role has only read and loco_admin capabilities, so it can be used to grant access to Loco Translate without providing any other admin permissions.

Note that the settings screen itself is the only Loco Translate screen that requires the manage_options capability.

API Keys

Available from version 2.4.0 of Loco Translate, this tab is where you save API keys for third party services. See Third party translation providers.

We cannot access your keys, but be aware that they are stored unencrypted in your WordPress database. It's advisable to remove them when they're not in active use. Alternatively you can use the loco_api_providers filter hook to apply credentials from a secure source of your own devising.

Be warned that this is a plugin-wide setting. Anyone with access to the Loco Translate editor has access to these keys which means they can also incur charges from the provider.

User options

The user options tab is available to all users that have access to Loco Translate. These options affect only the currently logged in user, and do so for all WordPress sites to which the user has access.

  • Translator credit
    This option specifies the Last-Translator header that appears in PO files that you edit. By default this credit will include your email address (because this is standard for Gettext files) but for reasons of privacy you may wish to enter something else. Note that leaving this blank will not produce a blank header, so always enter something to avoid the default credit.