2018-09-18 13:14:39 +02:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
(function(){
|
|
|
|
"use strict";
|
|
|
|
|
2019-11-28 01:26:35 +01:00
|
|
|
let scope;
|
2018-09-18 13:14:39 +02:00
|
|
|
if ((typeof exports) !== "undefined"){
|
|
|
|
scope = exports;
|
|
|
|
}
|
|
|
|
else {
|
2019-03-12 22:24:23 +01:00
|
|
|
scope = require.register("./settingStrings", {});
|
2018-09-18 13:14:39 +02:00
|
|
|
}
|
|
|
|
|
2019-04-09 08:29:52 +02:00
|
|
|
const extension = require("./extension");
|
|
|
|
|
2018-09-18 13:14:39 +02:00
|
|
|
scope.getMessages = function(settingDefinition){
|
2018-09-21 16:40:24 +02:00
|
|
|
const messages = [];
|
2019-12-29 00:18:05 +01:00
|
|
|
if (!settingDefinition){
|
|
|
|
return messages;
|
|
|
|
}
|
|
|
|
|
|
|
|
messages.push(settingDefinition.name + "_title");
|
|
|
|
messages.push(settingDefinition.name + "_description");
|
|
|
|
if (settingDefinition.urlSpecific){
|
|
|
|
messages.push(settingDefinition.name + "_urlSpecific");
|
|
|
|
}
|
|
|
|
if (settingDefinition.options){
|
|
|
|
settingDefinition.options.forEach(function(option){
|
|
|
|
if (option !== null){
|
|
|
|
messages.push(settingDefinition.name + "_options." + option);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (settingDefinition.inputs){
|
|
|
|
settingDefinition.inputs.forEach(function(input){
|
|
|
|
if (input && input.options){
|
|
|
|
input.options.forEach(function(option){
|
|
|
|
if (option !== null){
|
|
|
|
messages.push(input.name + "_options." + option);
|
2018-09-21 16:40:24 +02:00
|
|
|
}
|
2019-12-29 00:18:05 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (settingDefinition.action){
|
|
|
|
messages.push(settingDefinition.name + "_label");
|
|
|
|
}
|
|
|
|
if (settingDefinition.actions){
|
|
|
|
settingDefinition.actions.forEach(function(action){
|
|
|
|
messages.push(action.name + "_label");
|
|
|
|
});
|
2018-09-18 13:14:39 +02:00
|
|
|
}
|
|
|
|
return messages;
|
|
|
|
};
|
|
|
|
|
|
|
|
scope.getStrings = function(settingDefinition){
|
|
|
|
const strings = [];
|
|
|
|
function addString(string){
|
|
|
|
if ((typeof string) === "string" && string.trim()){
|
|
|
|
strings.push(string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
addString(settingDefinition.name);
|
|
|
|
if (settingDefinition.options){
|
|
|
|
settingDefinition.options.forEach(function(option){
|
|
|
|
addString(option);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
scope.getMessages(settingDefinition).forEach(function(message){
|
2019-04-09 08:29:52 +02:00
|
|
|
addString(extension.getTranslation(message));
|
2018-09-18 13:14:39 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
return strings;
|
|
|
|
};
|
|
|
|
}());
|