How to Change the Default Text Strings in Drupal 8
Drupal 8.5 is available now, and we covered some of the key new features.
However, some smaller, but very useful features arrived with 8.5. For example, it’s now much easier to translate the default text.
A few years ago, we explained how to translate the default text in Drupal 7. The process was painful! Let me show you how much easier it is in Drupal 8.5.
First, go to the “Extend” tab and enable the “Interface Translation” and “Language” module:
- Next, go to “Configuration”, then “Languages”.
- Click “Edit” next to “English” (or whatever your site’s default language is).
- Select the box, “Enable interface translation to English”.
- Click “Save language”.
- Next, go to “Configuration”, then “User interface translation”.
- You can search for and translate language strings directly from this screen. In this example, I’m changing “Weight” to “Gravity”.
- Click “Save translations”.
That’s really all there is to the process. It’s much, much easier than in Drupal 7. Here is my translated text live on the site:
Great ! It’s working, waiting for a long time about a d8 version of String Overrides. Thank you !
I wonder how to be able to translate other strings then only the labels. For example when a post is submitted, ‘submitted by’,
‘read more’, ‘3 comments’, ‘log in or register to post comments’, ‘log in’ …. manny help text …. do we have to rewrite this modules if we want to change anny of those?
Seems you can still also override through settings.php –
$settings[‘locale_custom_strings_en’][”] = [
‘Content’ => ‘Stuff’,
Ugh…. forgot to wrap it in code tags…
[code]$settings[‘locale_custom_strings_en’][”] = [
‘Content’ => ‘Stuff’,
Thank you for that. It works.
However, we decided to uncheck that since we no longer need that option.
Problem now is that cron continuously keeps on searching for translation files for ALL modules ending in en.po and I am getting a lot of notice warning via drush everytime I run cron… Example:
[code]Translation file not found: https://ftp.drupal.org/files/translations/all/drupal/drupal-9.1.4.en.po.%5B/code%5D
It is doing this for all modules on every cron! Our watchdog is getting full of these logs.
It should not be searching for this since we unchecked the box you mentioned, so what is triggering cron to continuously look for these and how do I disable this from searching for all these english translation files which do not exist since drupal’s default language is English?