Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Load default language overrides #35209

Merged
merged 4 commits into from
Aug 23, 2021

Conversation

bembelimen
Copy link
Contributor

Summary of Changes

On multilingual sites the translations of language strings falls back to the default language (when not in debug mode). But if you have created some language overrides this behaviour does not apply.

Testing Instructions

  • Create a multlingual page
  • Install and activate at least one additional language to en-GB
  • Create a language override for a not existing constant like: TEST_CONSTANT="Test" for the english frontend language
  • open the index.php of your frontend template and put: echo Text::_('TEST_CONSTANT');
  • Switch to the 2nd language

Actual result BEFORE applying this Pull Request

TEST_CONSTANT is outputted.

Expected result AFTER applying this Pull Request

Test is outputted.

(cherry picked from commit 3e0f3a3)
(cherry picked from commit b382e79)
*/
if (!$this->debug && $lang !== $this->default)
{
$this->loadLanguage(JPATH_BASE . '/language/overrides/' . $this->default . '.override.ini');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own clarity - we call loadLanguage instead of parse directly so it can go into $this->strings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, parse only returns the strings loadLanguage parses internally and put it in $this->strings. Important is, that we don't do it in $this->override otherwise we would override again and again but we just handle it like a normal ini language file.

wilsonge and others added 2 commits August 20, 2021 01:17
Co-authored-by: Phil E. Taylor <phil@phil-taylor.com>
@maikol-ortigueira
Copy link

I have tested this item ✅ successfully on ee4dd24

I've tested successfully.

Thank you.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35209.

@BertaOctech
Copy link

I have tested this item ✅ successfully on ee4dd24

Applying the patch had the described effect

Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35209.

@Quy Quy removed the PR-4.0-dev label Aug 20, 2021
@Quy
Copy link
Contributor

Quy commented Aug 20, 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35209.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 20, 2021
@Quy Quy added the PR-4.0-dev label Aug 20, 2021
@drmenzelit drmenzelit added this to the Joomla 4.0.1 milestone Aug 23, 2021
@drmenzelit drmenzelit merged commit 9e4f8f9 into joomla:4.0-dev Aug 23, 2021
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 23, 2021
@drmenzelit
Copy link
Contributor

Thanks

@bembelimen bembelimen deleted the 4.0/load-default-overrides branch March 15, 2024 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants