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

cultureKey preventing saving in one language #70

Open
Mark-H opened this issue Sep 30, 2022 · 0 comments
Open

cultureKey preventing saving in one language #70

Mark-H opened this issue Sep 30, 2022 · 0 comments

Comments

@Mark-H
Copy link

Mark-H commented Sep 30, 2022

Bear with me on this one, as I'm not 100% sure if I fully understand what's happening. The problem is the site, configured with NL, EN, and FR languages, refused to save English. Dutch and French work fine. Dutch (NL) is the system-configured cultureKey.

In the Lingua service class' setContentTranslation() method it's trying to load the cultureKey from the context, and skip that language its values if it's the same. I guess as the primary language goes on the resource itself.

For some reason I haven't been able to decipher yet, that line is returning en for me. The cultureKey system setting is set to nl and the (only) context does not have a cultureKey setting. The only reason I can think of it may be using en for me is if it sniffed the browser, but is that supposed to affect the manager? If so that suggests a front-end language may affect what languages can be saved, which wouldn't be great.

When changing:

     $defaultCultureKey = $this->modx->context->getOption('cultureKey');

to

      $defaultCultureKeySetting = $this->modx->getObject('modSystemSetting', array('key' => 'cultureKey'));
      $defaultCultureKey = $defaultCultureKeySetting ? $defaultCultureKeySetting->get('value') : $this->modx->context->getOption('cultureKey');

it once again saves the English and seems to behave as it should. But I'm not sure if that truly is the way to fix it. Feedback would be welcome..

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

No branches or pull requests

1 participant