Django CMS - Multilanguage setup translates plugins in edit mode - django

I am using django-cms version 3.7.1 with multilanguage setup.
Default and admin user language is set to english 'en', second one is German 'de'.
Everything is running ok (url, editing content for each language), except one detail - admin user language is set to English, so toolbar menu is always English, but when i switch to edit page content in deutch, plugin modal window with editor show german translation for buttons etc.
Is that supposed to work that way? Now plugin text is always changing according to page language (if i add spanish for example, button will be in spanish).
I need plugins to have text in language admin user have in own settings. In this case always English.. even when editing German page.
Does anyone know how to achieve this?
Thanks
Screenshot how it look like in browser

Related

How to preview a Wagtail page with translated fields in different languages?

I have a multi-language Wagtail website with two languages (English and German) using duplicated fields in my page models, e.g. a text block has two fields, text_de and text_en, and I define text as a translated field following the example in the translating content documentation. (I.e. I am NOT duplicating the whole page tree.) Here's an example how that looks in my code:
[models.py]
class MyPage(Page):
...
text_de = models.CharField(max_length=1024)
text_en = models.CharField(max_length=1024)
text = TranslatedField('text_en', 'text_de')
Everything works perfectly fine, in templates I can just use {{ text }} and depending on the active language (using i18n patterns and LocaleMiddleware) the correct version is displayed.
BUT: I have issues with getting a page preview in both languages.
When an editor creates a draft page in Wagtail admin and clicks on 'preview', then a page preview is shown in the language used within the Wagtail admin, i.e. in the language defined by the current editor's language preferences in his or her account settings.
How could the editor also preview the page in another language (without switching the language in his or her account settings back and forth)?
Is there maybe a way to construct a view that sets a different language before creating the page preview? Or is there another way to solve this?
I've tried to find out when Wagtail/Django decides which language it should serve and found the method get_url_parts of wagtail/admin/core/models, Page class. The page_path returned from this function is suffixed with '/de' or '/en', depending on the editor's account settings.
I can permanently change the language in which a page is displayed using translation.activate(). E.g. if I add translation.activate('en') to the get_context method of the MyPage class, then a MyPage-page and its previews are always shown in English. That's not really helpful.
I tried to construct a view, that first sets the language and then redirects to the preview like this:
[views.py]
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils import translation
def preview_language(request, pk=None, language='en'):
if language == 'de':
translation.activate(language)
else:
translation.activate('en')
return HttpResponseRedirect(reverse('wagtailadmin_pages:preview_on_edit', args=(pk,)))
But the language is set back to the editor's language from the account settings when the redirect is performed. And I am not sure that this is actually the way to go ...
Does anyone have a (different?) idea how to enable editors to easily preview a page with translated fields in different languages?
I am currently using Wagtail 2.4, Django 2.1, Python 3.5.
Any help is greatly appreciated! :-)
Wagtail's "preview modes" feature would probably help here: https://docs.wagtail.io/en/stable/reference/pages/model_reference.html#wagtail.core.models.Page.preview_modes
You could define English and German as two preview modes on your page model, and override the serve_preview method to activate the appropriate translation based on the received mode_name argument.

Sitecore not displaying foreign version of datasource when site language is set to be foreign

Sitecore does not seem to be using the version of a datasource that matches the current site language. I created a new version of a text-based item using the "translate" feature. This created a new version of the datasource under the "es-MX" category. I then set the current language to "es-MX" through the editing ribon. The page reloaded with a new URL:
mydomain.com/es-MX/path/to/page
However, I still see the English version of the datasource. Also, in the editing ribbon, the thumbnail above "Language" is still the US flag with the word "English".
Is there something that I am forgetting to do? This is on Sitecore 7.5
Figured it out. You have to make a new version of the page as well. If you try viewing your page in a different language whilst not in editing mode, it will display a page with the words "Default Page". This got me to try making a Spanish version of the page itself, not just the datasource present on it. After doing so, I was able to successfully change the page's language (thumbnail changed this time), and the datasource displayed its Spanish version.

Sitecore displaying Japanese even though language is set to English

Some elements of Sitecore have randomly started using Japanese. I have checked for the following issues:
I have checked to make sure our Sitecore instance is set to English.
I looked through the entire solution for references to jp but it doesn't seem that it is being hardcoded into anywhere.
This has been affecting the following:
RTE's (the element selection menu e.g h1, h2, h3... is in Japanese)
Our validation rules:
Anyone had a similar issue.
This is on Sitecore 7.5.
UPDATE 1
I see that some items under core/sitecore/system/Dictionary have the Phrase field set to Japanese text. Could this have anything to do with it?
The user you're logging in with, what language preferences is set for it?
Is one thing that the Sitecore site runs in English, but a CMS editor user can still prefer to operate Sitecore in another language.
Control Panel => Region and Language settings
Figured it out. I'm assuming this was a bug in Sitecore but what happened is that all the Japanese translations in the core database's dictionary were moved to the English versions. This meant that it would translate to Japanese if it detected the mode was set to English.

sitecore editframe button support multilanguage

I have been playing around with Editframe buttons in a Sitecore 8 for a multilingual project and I have the feeling that Edit Frame buttons do not work properly on sitecore multilingual sites.
Were you able to get it working edit frame buttons with a multilingual implementation?
Is it working out of the box or do you need any special configuration?
My experience is that when I am on a localized page and I click on an EditFrame button, it will open the default language Item instead of the localised item. I am of the impression that this is what happen when you click on Edit the Related Item in the Experience Editor.
I encountered your scenario very recently.
Were you able to get it working edit frame buttons with a multilingual implementation?
Yes, all the Fields I set up within the Edit Frame Buttons in the Core worked correctly with my Multilingual Site
Is it working out of the box or do you need any special configuration?
You need to add your Field Names into the Edit Frame Button Items in the Core database, found at the out-of-the-box path; /sitecore/content/Applications/WebEdit/Edit Frame Buttons/Default/Edit. Make sure your sc:Edit component references this path in the Buttons property
You may use different Display Names of the Fields for each of your languages for ease of use in the Content Editor / Experience Editor but as long as they are display Names it should be fine. If they are not and it doesn't work I recommend putting the Field Name for each language in the Edit Frame Item.
When I click on an EditFrame button, will it open the default language Item instead than the localised item, I am of the impression that this is what happen when you click on Edit The Related item as well
No, in both instances the Item will be loaded in the correct Language as well as when you create a new Datasource Item to be referenced by your Component.
The biggest issue that is present is when Edit the Relating Item and make changes to Rich Text Editor field or TreeEx field is that when you save it, it saves it to the default enlanguage, even creating a Language Version for it if it does not exist.
I have raised this issue with Sitecore Support and they are currently investigating. When they have a fix I'll update you with their solution.
EDIT
The Support Patch to resolve the issue Edit the Relating Item saving changes to the wrong language version of the Item can be found here - https://kb.sitecore.net/articles/814090

Customize Sitecore Content Editor Language Selector

I have already customize the Page Editor Language Selector by overriding the webedit command, but I can't figure out how to customize the Content Editor Language Selector:
I am trying to replicate the functionality I added for the Page Editor Language Selector, which sorts the languages by region and then language name, and also adjusts the name to not display the ": language (region)" part.
I have already tried overriding the Sitecore.Shell.Applications.Globalization.SelectLanguage.SelectLanguagePage on the SelectLanguage.xaml.xml shell file, but that is for the More Langauges dialog and not for the initial view of the languages. I have also tried overriding the ribbon:languages command, but that is for the click event on each language for actually selecting it.
Any suggestions where else I should look for this functionality?
That menu is generated by \sitecore\shell\Applications\Content Manager\Galleries\Languages\Gallery Languages.xml and the associated CodeBeside in Sitecore.Shell.Applications.ContentManager.Galleries.Languages.GalleryLanguagesForm, Sitecore.Client
The rendering of each option is control by \sitecore\shell\Applications\Content Manager\Galleries\Languages\Gallery Languages.Option.xml although the values are set from the CodeBeside.
BTW, I just used the Chrome Dev Tools to figure out what was going on. From the Network Panel there is an XHTTP call to default.aspx?xmlcontrol=Gallery.Languages. Useful debugging steps.