Skip to content

Bug: IncomingRequest::setLocale() #3640

Closed
@nicojmb

Description

@nicojmb

Describe the bug
I've a LanguageFilter wiht method "before" to check session value and set current languange with method setLanguage($locale) in the codigniter request classs.

In debug toolbar the the laguage is correct but translations show incorrect language (when i use lang() always return default language translation).

the problem only happens when i've an lang() function call before the request()->setLocale($language) and static service language not update when run setLocale($locale) and return next translation with default locale.

image

image

The translation files are correct, if i change default language to english, showme "logout" twice :(

image

If i comment the first lang() then works as expected.

CodeIgniter 4 version
4.0.4

Affected module(s)
Language Helper
Language Service

Expected behavior, and steps to reproduce if appropriate
lang() function get correct translation after "setLocale" function.

Context

  • OS: Centos
  • Web server: Nginx
  • PHP version: 7.4.10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions