MDL-79498 javascript: Adjust get_string function signature

Reflect param and lang being optional parameters.
This commit is contained in:
Justus Dieckmann 2023-09-26 14:27:23 +02:00 committed by Jun Pataleta
parent aeb64dbfb5
commit 216047dc18
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
3 changed files with 14 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -49,9 +49,9 @@ let promiseCache = [];
* from the server and resolved when available.
*
* @param {string} key The language string key
* @param {string} component The language string component
* @param {string} param The param for variable expansion in the string.
* @param {string} lang The users language - if not passed it is deduced.
* @param {string} [component='core'] The language string component
* @param {object|string} [param] The param for variable expansion in the string.
* @param {string} [lang] The users language - if not passed it is deduced.
* @return {jQuery.Promise} A jQuery Promise containing the translated string
*
* @example <caption>Fetching a string</caption>
@ -73,10 +73,10 @@ export const get_string = (key, component, param, lang) => {
* from the server and resolved when available.
*
* @param {string} key The language string key
* @param {string} component The language string component
* @param {string} param The param for variable expansion in the string.
* @param {string} lang The users language - if not passed it is deduced.
* @return {Promise} A native Promise containing the translated string
* @param {string} [component='core'] The language string component
* @param {object|string} [param] The param for variable expansion in the string.
* @param {string} [lang] The users language - if not passed it is deduced.
* @return {Promise<string>} A native Promise containing the translated string
*
* @example <caption>Fetching a string</caption>
*
@ -85,9 +85,9 @@ export const get_string = (key, component, param, lang) => {
* getString('cannotfindteacher', 'error')
* .then((str) => window.console.log(str)); // Cannot find teacher
*/
export const getString = (key, component, param, lang) => getRequestedStrings([{key, component, param, lang}])[0];
export const getString = (key, component, param, lang) =>
getRequestedStrings([{key, component, param, lang}])[0];
// eslint-disable-next-line camelcase
/**
* Make a batch request to load a set of strings.
*
@ -95,7 +95,7 @@ export const getString = (key, component, param, lang) => getRequestedStrings([{
* The Promise will only be resolved once all strings are available, or an attempt has been made to fetch them.
*
* @param {Array.<StringRequest>} requests List of strings to fetch
* @return {Promise[]} An array of native promises containing the translated strings
* @return {Promise<string[]>} A native promise containing an array of the translated strings
*
* @example <caption>Fetching a set of strings</caption>
*
@ -126,7 +126,7 @@ export const getStrings = (requests) => Promise.all(getRequestedStrings(requests
* Internal function to perform the string requests.
*
* @param {Array.<StringRequest>} requests List of strings to fetch
* @returns {Promise<string>}
* @returns {Promise[]}
*/
const getRequestedStrings = (requests) => {
let requestData = [];
@ -213,7 +213,7 @@ const getRequestedStrings = (requests) => {
* The Promise will only be resolved once all strings are available, or an attempt has been made to fetch them.
*
* @param {Array.<StringRequest>} requests List of strings to fetch
* @return {Promise[]} An array of native promises containing the translated strings
* @return {jquery.Promise<string[]>} A jquery promise containing an array of the translated strings
*
* @example <caption>Fetching a set of strings</caption>
*

View File

@ -700,7 +700,7 @@ M.util.js_complete = function(uniqid) {
*
* @param {String} identifier string identifier
* @param {String} component the component providing the string
* @param {Object|String} a optional variable to populate placeholder with
* @param {Object|String} [a] optional variable to populate placeholder with
*/
M.util.get_string = function(identifier, component, a) {
var stringvalue;