Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/languages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,26 @@ export async function getLanguage( requestUtils, slug ) {
/**
* Creates a language.
*
* @param {RequestUtils} requestUtils Gutenberg request utils object.
* @param {string} locale Language locale to create.
* @param {RequestUtils} requestUtils Gutenberg request utils object.
* @param {string} locale Language locale to create.
* @param {Object} [args = {}] Additional arguments to pass to the request, optional. For the full list of arguments, see the REST API documentation.
* @param {string} [args.slug] Language slug to create.
* @param {string} [args.name] Language name to create.
* @param {boolean} [args.is_rtl] If the language is rtl.
* @param {string} [args.flag_code] The flag code of the language.
* @param {number} [args.page_on_front] The ID of the page on front for the language.
* @param {number} [args.page_for_posts] The ID of the page for posts for the language.
* @param {number} [args.term_group] The term group (order) of the language.
* @param {boolean} [args.no_default_cat] Whether to create the default category for the language.
* @return {Promise} Request promise.
*/
export async function createLanguage( requestUtils, locale ) {
export async function createLanguage( requestUtils, locale, args = {} ) {
return requestUtils.rest( {
path: BASE_PATH,
method: 'POST',
params: {
locale,
...args,
},
} );
}
Expand Down