Translate labels and log messages

This commit is contained in:
Florent Fayolle 2021-07-25 16:38:19 +02:00
parent 9597cddc80
commit 8f8f0c3cb0

View File

@ -25,11 +25,11 @@ async function register({
registerSetting({
name: "ytb-urls",
label: "liste des urls youtube a auto-importer",
label: 'URL list of Youtube channel to synchronize',
type: "input-textarea",
});
logger.warn("setting register");
logger.debug("setting register");
fs.appendFileSync(path.join(basePath, "/storage.bd"), "");
const configAggregator = await ListenerRssAggregator.instantiateAggregator(
@ -43,12 +43,12 @@ async function register({
password: "test",
});
logger.warn("Aggregator created");
logger.debug("Aggregator created");
const inputs = await settingsManager.getSetting("ytb-urls");
if (inputs) await addListeners(inputs);
logger.warn("Config loaded");
logger.debug("Config loaded");
settingsManager.onSettingsChange(async (settings: any) => {
await addListeners(settings["ytb-urls"]);
@ -58,11 +58,10 @@ async function register({
const datas = listenersDataBinding.get(entries.addressListener);
if (!datas) return;
logger.warn(
"Nouvelles entrées détéctées: " +
JSON.stringify(entries) +
" de " +
datas.channelId
logger.debug(
"New entries detected from channel #%i: %s",
datas.channelId,
JSON.stringify(entries)
);
for (const item of entries.items)
peertube.apiRequest({
@ -77,7 +76,7 @@ async function addListeners(listenerInput: string) {
try {
listeners = JSON.parse(listenerInput);
} catch {
logger.warn("Erreur: malformé");
logger.error("Malformed URL");
return;
}
let newListeners = listeners.filter(
@ -97,14 +96,13 @@ async function addListeners(listenerInput: string) {
myManager.stopAll();
await myManager.saveOverride(listeners);
if (logger) logger.warn("Configuration modifiée: " + listenerInput);
if (logger) logger.warn("Configuration changed: " + listenerInput);
myManager.startAll();
}
async function unregister() {
myManager.stopAll();
return;
}
module.exports = {