# Complex language/translations issues

**URL:** <https://discourse.cakephp.org/t/complex-language-translations-issues/9108>\
**Category:** Need Help\
**Tags:** translation, i18n\
**Created:** [March 10, 2021, 8:01pm UTC](https://discourse.cakephp.org/t/complex-language-translations-issues/9108 "2021-03-10T20:01:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarekDM](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@MarekDM](https://discourse.cakephp.org/u/MarekDM)\
**Post date:** [March 10, 2021, 8:01pm UTC](https://discourse.cakephp.org/t/complex-language-translations-issues/9108/1 "2021-03-10T20:01:53Z")

</div>

Hello

Here’s my problem. I have website, where are users connected to accounts.

Each account can have 1-3 languages, and their users can use as default language offered by the account. So here’s what I want to achieve and so far I’m blind to solution.

Example  
Account1 → default language English → so everything should be in English no need for translations fields in articles.

Account2-\> default language French → same as above I run  
\Cake\I18n\I18n::clear();  
\Cake\I18n\I18n::setLocale(‘fr’);

All seems to work

Account3 → default language French + second language English.  
Problem: I want user if this account to see all static texts etc in English BUT, to still have default texts from DB in French with option to add translations to English. And here I fail. When I use setLocale I get translations etc. but it overrides data in main table with English content instead of still treating it like translation.

To sum up, articles based on account have different default language and may have remaniningtranslations in i18n table. While logged user can have as default different language than the default language of account he belongs to, and for the content management I do not want to affect the languages only for display.

I think in old time there was L10n and i18n and was possible to set them aparat. Right now I got stuck.

PS: I’m looking for general/config solution as there are 100+ forms to rework otherwise which I would love to avoid with some cake love

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [March 10, 2021, 9:50pm UTC](https://discourse.cakephp.org/t/complex-language-translations-issues/9108/2 "2021-03-10T21:50:18Z")

</div>

Can you show a bit of a mockup or wireframe of what you expect your page to look like in the third situation? I’m struggling to understand how you think you’ll be able to display two separate languages without making any changes at all to the forms.

---

<div class="post-metadata">

**Author:** ![MarekDM](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@MarekDM](https://discourse.cakephp.org/u/MarekDM)\
**Post date:** [March 11, 2021, 8:45am UTC](https://discourse.cakephp.org/t/complex-language-translations-issues/9108/3 "2021-03-11T08:45:30Z")

</div>

```
foreach ($activeLanguages as $l => $info) {
        echo '<div class="row lang_' . $l . '">';
        $langAddon = '';
        if ($l != $accountDefaultLanguage) {
            $langAddon = '_translations.' . $l . '.';
        }
        echo $this->Form->control($langAddon . 'title', ['label' => '<span class="lang">' . $info['display'] . '</span> ' . __('Description'), 'escape' => false]);
        echo '</div>';
    }

```

That’s how currently forms are build. I have list of active languages and default one. Based on that I generate main field + translation fields if necessary

---

<div class="post-metadata">

**Author:** ![MarekDM](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@MarekDM](https://discourse.cakephp.org/u/MarekDM)\
**Post date:** [March 11, 2021, 8:57am UTC](https://discourse.cakephp.org/t/complex-language-translations-issues/9108/4 "2021-03-11T08:57:43Z")

</div>

I think what I need is to not change the I18n setup but only load the translations from specific locale/fr/default.po file. So static texts would match logged user language yet all the content from DB would be matching account setup
