Translation files

Types of Translation Files

A concrete5 installation support multiple language files:

  • the core translations
  • the package translations
  • the site translations

Precedence of Translations Files

Strings specified in core translations can be overridden by strings specified in package and site translations. Strings package translations can be overridden by strings specified in the site translations.

Updating Core and Package Translations

The core translations and the package translations can be installed and updated via the /dashboard/system/basics/multilingual/update dashboard site or via the c5:install-language CLI command. Those translations are provided by community contributors using the translate.concrete5.org website.

Site Translations

Site translations are managed via the /dashboard/system/multilingual/translate_interface dashboard page. You first need to click the "Reload Strings" button, then you can translate the extracted strings.

What are the strings extracted by "Reload Strings"

  • the site name
  • the strings included in t()/tc()/t2() calls of every PHP file present in these directories (or sub-directories):
    • /application/blocks
    • /application/elements
    • /application/controllers
    • /application/mail
    • /application/page_types
    • /application/single_pages
    • /application/themes
    • /application/views
    • /application/src
  • the names of block templates found in /application/blocks and /application/themes
    For example, if you have a file /application/blocks/block_handle/templates/template_handle.php you will be able to translate Template Handle
  • the names of theme preset found in /application/themes
    For example, if you have a file /application/themes/theme_handle/css/presets/filename.less that contains @preset-name: "Preset Name", you'll be able to translate Preset Name
  • the strings provided by the getTranslatableStrings method of the controllers of the installed packages
  • the names of all the defined areas
  • the names of attribute keys
  • the names of attribute key categories
  • the names of attribute sets
  • the names of attribute types
  • the names of authentication types
  • the names and descriptions of user groups
  • the names of user group sets
  • the names of job sets
  • the names of permission access entity types
  • the names and descriptions of permission keys
  • the names and descriptions of permission key categories
  • the options of select attribute values
  • the names of concrete5 trees and their notes

Overriding core and package translations

In order to override a string used by the concrete5 core of by a package, you simply have to create a php file under the /application/src directory. For instance, you may want its contents to be

<?php
defined('C5_EXECUTE') or die('Access Denied.');
return;
t('String');

so that you can override the translation of the String string.

Loading Conversation