Skip to content
Snippets Groups Projects
Commit bc07c48f authored by Marius Dumitru Florea's avatar Marius Dumitru Florea
Browse files

XWIKI-8605: Editing a document in french, or other language provided as...

XWIKI-8605: Editing a document in french, or other language provided as translation, doesn't use the provided sheet
* The sheet is not applied for new translations because EditAction doesn't mark them with setTranslation(1).
* Copy the title from the default translation to the new translation and set the default locale of the new translation.
* New translations edited in inline mode are not saved correctly because editinline.vm doesn't submit the right language.
parent 59be92a5
No related branches found
No related tags found
No related merge requests found
......@@ -96,6 +96,12 @@ public String render(XWikiContext context) throws XWikiException
// Edit a new translation.
tdoc = new XWikiDocument(doc.getDocumentReference());
tdoc.setLanguage(languageToEdit);
tdoc.setDefaultLocale(doc.getDefaultLocale());
// Mark the translation. It's important to know whether a document is a translation or not, especially
// for the sheet manager which needs to access the objects using the default document not one of its
// translations.
tdoc.setTranslation(1);
tdoc.setTitle(doc.getTitle());
tdoc.setContent(doc.getContent());
tdoc.setSyntax(doc.getSyntax());
tdoc.setAuthorReference(context.getUserReference());
......
......@@ -55,7 +55,10 @@ $xwiki.ssfx.use('uicomponents/widgets/fullScreen.css', true)##
<input type="hidden" name="xredirect" value="$!{escapetool.xml($request.get('xredirect'))}" />
<input type="hidden" name="xnotification" value="$!{escapetool.xml($request.get('xnotification'))}" />
<input type="hidden" name="template" value="$!{escapetool.xml($request.template)}" />
<input type="hidden" name="language" value="$!{escapetool.xml($doc.language)}" />
## We need to submit the language of the translated document because the inline edit mode is not limited to editing only
## the objects, which are shared by all translations. We can also edit the content or the title of the document which are
## specific to each translation and so we need to specify which translation is being edited.
<input type="hidden" name="language" value="$!{escapetool.xml($tdoc.realLanguage)}" />
#if("$!request.parent" != '')
<input type="hidden" name="parent" value="$escapetool.xml($!request.parent)" />
#end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment