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

Bug: Translation key separated by dot #2932

Closed
MichalPB1 opened this issue May 5, 2020 · 1 comment · Fixed by #2938
Closed

Bug: Translation key separated by dot #2932

MichalPB1 opened this issue May 5, 2020 · 1 comment · Fixed by #2938
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@MichalPB1
Copy link

Describe the bug
In version 4.0.2 translation keys may be separated by a dot. E.g

return [
     'quantity' => 'Quantity',
     'logs.quantity' => 'The quantity of the product has been changed to <b>{value}</b>',
];

However, in version 4.0.3 it no longer works as before. The logs.quantity key is not found, but strangely, the value from the quantity key is returned. If the quantity key is deleted, we get nothing.

After changing the split into nested arrays, everything works as it should

return [
    'quantity' => 'Quantity',
    'logs' => [
        'quantity' => 'The quantity of the product has been changed to <b>{value}</b>',
    ],
];

CodeIgniter 4 version
4.0.3

Affected module(s)
Language

Probably after changes in this pull request #2833

Expected behavior, and steps to reproduce if appropriate

If we don't use nested arrays in translations

lang ('Product.quantity') should return Quantity

lang ('Product.logs.quantity') should return The quantity of the product has been changed to <b>{value}</b>

Context

  • OS: Ubuntu
  • Web server cli-server
  • PHP version 7.3
@MichalPB1 MichalPB1 added the bug Verified issues on the current code behavior or pull requests that will fix them label May 5, 2020
samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue May 5, 2020
@samsonasik
Copy link
Member

I've created PR #2938 for it.

samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue May 5, 2020
samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue May 5, 2020
samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue May 5, 2020
samsonasik added a commit to samsonasik/CodeIgniter4 that referenced this issue May 6, 2020
lonnieezell added a commit that referenced this issue May 6, 2020
Fixes #2932 : Fix Translation key separated by dot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants