API:SetPageLanguage

Token
To change the page language for a page, an edit token is required via action=tokens or by using the following method:

Changing page language
The language for a page can be changed using action=pagelang.

Parameters

 * : A list of titles
 * : The target language for the page(s), if not set taken as default wiki language.
 * : The token obtained in the previous request. Take care to urlencode the  as.

Don't forget to append = even to parameters with no value, for example &lang doesn't work, &lang= does work

Example
Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=pagelang requires POST requests; GET requests will cause an error.

Possible errors
In addition to the usual stuff:

{| class="wikitable sortable" ! Code !! Info
 * notoken || The token parameter must be set
 * badlanguage-code || The language code is not valid
 * nopagetext || The page doesn't exist
 * page-changelang-nopermission || User doesn't have permission to change the language or the page language change isn't allowed.
 * changelang-none || No change in the page language, the old and the new languages are same.
 * changelang-fail || The language change failed.
 * page-changelang-nopermission || User doesn't have permission to change the language or the page language change isn't allowed.
 * changelang-none || No change in the page language, the old and the new languages are same.
 * changelang-fail || The language change failed.
 * changelang-none || No change in the page language, the old and the new languages are same.
 * changelang-fail || The language change failed.
 * changelang-fail || The language change failed.