# REST page content upload with multi language support - language is set to None

**URL:** <https://forum.xwiki.org/t/rest-page-content-upload-with-multi-language-support-language-is-set-to-none/10216>\
**Category:** Help / Discuss\
**Tags:** rest, multi-language\
**Created:** [April 21, 2022, 12:20pm UTC](https://forum.xwiki.org/t/rest-page-content-upload-with-multi-language-support-language-is-set-to-none/10216 "2022-04-21T12:20:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![greniac](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/g/a183cd/32.png) [@greniac](https://forum.xwiki.org/u/greniac)\
**Post date:** [April 21, 2022, 12:20pm UTC](https://forum.xwiki.org/t/rest-page-content-upload-with-multi-language-support-language-is-set-to-none/10216/1 "2022-04-21T12:20:10Z")

</div>

We are writing a migration tool from FOSWiki to XWiki. In our old FOSWiki, we have pages in multiple languages: German and English, with German being the main language. We therefore have configured XWiki to use German and English language with German as the default language.

Our migration tool uses the XWiki REST API to upload the created pages.

There seems to be something off:  
The language specified when uploading is ignored sometimes.

In order to create a page, we send following the following XML to the URL `https://somedomain.lol/rest/wikis/xwiki/spaces/Informatik/spaces/Helpdesk/pages/Accountverlaengern/`

```auto
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>                                                        
<page xmlns="http://www.xwiki.org">                                                                            
  <id>xwiki:Informatik/Helpdesk.Accountverlaengern</id>                                                        
  <fullName>Informatik/Helpdesk.Accountverlaengern</fullName>                                                  
  <wiki>xwiki</wiki>                                                                                           
  <space>Informatik/Helpdesk</space>                                                                           
  <name>Accountverlaengern</name>                                                                              
  <title>Accountverlaengern</title>                                                                            
  <parent></parent>                                                                                            
  <parentId></parentId>                                                                                        
  <version>1.1</version>                                                                                       
  <author>XWiki.Admin</author>
  <authorName>Unknown</authorName>
  <xwikiRelativeUrl>https://somedomain.lol/bin/view/Informatik/Helpdesk/Accountverlaengern</xwikiRelativeUrl>
  <xwikiAbsoluteUrl>https://somedomain.lol/bin/view/Informatik/Helpdesk/Accountverlaengern</xwikiAbsoluteUrl>
  <syntax>xwiki/2.1</syntax>
  <language>de</language>
  <majorVersion>1</majorVersion>
  <minorVersion>1</minorVersion>
  <hidden>false</hidden>
  <created>1970-01-01T00:00:00+00:00</created>
 <creator>XWiki.Admin</creator>
 <creatorName>Unknown</creatorName>
 <modified>2022-04-21T13:30:57</modified>
 <modifier>XWiki.Admin</modifier>
 <modifierName>Foswiki Migration Bot</modifierName>
 <comment>Imported from foswiki</comment>
 <content><![CDATA[my awesome page full of content about Accountverlängering lol]]</content>
</page>

```

After this succeeds, we send the same XML request to the same URL but with the `<language>` tag set to `en` and the content in English language.

When we now take a look at the resulting page we have a page translation in English but the original locale of the page is set to `None` and contains the German translation. It does not matter which translation we send first, it is always the German one that gets “stripped” of its locale (i.e. locale is `None`).

This is a problem because when a wiki user changes their preferred language in global language preference (the top-right menu), you can only select English there, but not German.

Am I doing something wrong here?  
What is the correct way to upload and create localized pages via the XWiki REST API?
