fix: update french translation, fix language bug and use abort controller on more tabs

Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
David Ralph 2021-04-18 20:51:33 +01:00
parent 6c4cc5c373
commit cb6e9ddf9c
13 changed files with 162 additions and 116 deletions

View File

@ -36,6 +36,7 @@ export default class Marketplace extends React.PureComponent {
install: <button className='addToMue' onClick={() => this.manage('install')}>{window.language.modals.main.marketplace.product.buttons.addtomue}</button>
};
this.language = window.language.modals.main.marketplace;
this.controller = new AbortController();
}
async toggle(type, data) {
@ -43,9 +44,15 @@ export default class Marketplace extends React.PureComponent {
let info;
// get item info
try {
info = await (await fetch(`${window.constants.MARKETPLACE_URL}/item/${this.props.type}/${data}`)).json();
info = await (await fetch(`${window.constants.MARKETPLACE_URL}/item/${this.props.type}/${data}`, { signal: this.controller.signal })).json();
} catch (e) {
return toast(window.language.toasts.error);
if (this.controller.signal.aborted === false) {
return toast(window.language.toasts.error);
}
}
if (this.controller.signal.aborted === true) {
return;
}
// check if already installed
@ -85,8 +92,12 @@ export default class Marketplace extends React.PureComponent {
}
async getItems() {
const { data } = await (await fetch(window.constants.MARKETPLACE_URL + '/all')).json();
const featured = await (await fetch(window.constants.MARKETPLACE_URL + '/featured')).json();
const { data } = await (await fetch(window.constants.MARKETPLACE_URL + '/all', { signal: this.controller.signal })).json();
const featured = await (await fetch(window.constants.MARKETPLACE_URL + '/featured', { signal: this.controller.signal })).json();
if (this.controller.signal.aborted === true) {
return;
}
this.setState({
items: data[this.props.type],
@ -116,6 +127,11 @@ export default class Marketplace extends React.PureComponent {
this.getItems();
}
componentWillUnmount() {
// stop making requests
this.controller.abort();
}
render() {
const errorMessage = (msg) => {
return (

View File

@ -41,6 +41,10 @@ export default class About extends React.PureComponent {
});
}
if (this.controller.signal.aborted === true) {
return;
}
const newVersion = versionData[0].tag_name;
let updateMsg = this.language.version.no_update;
@ -48,9 +52,6 @@ export default class About extends React.PureComponent {
updateMsg = `${this.language.version.update_available}: ${newVersion}`;
}
if (this.controller.signal.aborted === true) {
return;
}
this.setState({
contributors: contributors.filter((contributor) => !contributor.login.includes('bot')),

View File

@ -9,10 +9,15 @@ export default class Changelog extends React.PureComponent {
title: null
};
this.language = window.language.modals.update;
this.controller = new AbortController();
}
async getUpdate() {
const data = await (await fetch(window.constants.BLOG_POST + '/index.json')).json();
const data = await (await fetch(window.constants.BLOG_POST + '/index.json', { signal: this.controller.signal })).json();
if (this.controller.signal.aborted === true) {
return;
}
this.setState({
title: data.title,
@ -21,15 +26,20 @@ export default class Changelog extends React.PureComponent {
author: 'By ' + data.authors.join(', '),
html: data.html
});
}
}
componentDidMount() {
componentDidMount() {
if (localStorage.getItem('offlineMode') === 'true') {
return;
}
this.getUpdate();
}
}
componentWillUnmount() {
// stop making requests
this.controller.abort();
}
render() {
const errorMessage = (msg) => {

View File

@ -13,10 +13,15 @@ export default class BackgroundSettings extends React.PureComponent {
value: 'loading'
}]
};
this.controller = new AbortController();
}
async getQuoteLanguages() {
const data = await (await fetch(window.constants.API_URL + '/quotes/languages')).json();
const data = await (await fetch(window.constants.API_URL + '/quotes/languages', { signal: this.controller.signal })).json();
if (this.controller.signal.aborted === true) {
return;
}
let array = [];
data.forEach(item => {
@ -35,6 +40,11 @@ export default class BackgroundSettings extends React.PureComponent {
this.getQuoteLanguages();
}
componentWillUnmount() {
// stop making requests
this.controller.abort();
}
render() {
const language = window.language.modals.main.settings.sections.language;

View File

@ -361,6 +361,7 @@
},
"toasts": {
"quote": "Kopierte Zitate",
"reset": "Reset successfully",
"installed": "Erfolgreich installiert",
"uninstalled": "Erfolgreich entfernt",
"error": "Etwas ist schief gelaufen",

View File

@ -361,6 +361,7 @@
},
"toasts": {
"quote": "Quote copied",
"reset": "Reset successfully",
"installed": "Successfully installed",
"uninstalled": "Successfully removed",
"error": "Something went wrong",

View File

@ -361,6 +361,7 @@
},
"toasts": {
"quote": "Quote copied",
"reset": "Reset successfully",
"installed": "Successfully installed",
"uninstalled": "Successfully removed",
"error": "Something went wrong",

View File

@ -361,6 +361,7 @@
},
"toasts": {
"quote": "Cita copiada",
"reset": "Restablecido correctamente",
"installed": "Instalado correctamente",
"uninstalled": "Retirado correctamente",
"error": "Algo salió mal",

View File

@ -1,5 +1,5 @@
{
"tabname": "New Tab",
"tabname": "Nouvel Onglet",
"widgets": {
"greeting": {
"morning": "Bonjour",
@ -18,18 +18,18 @@
},
"search": "Rechercher",
"quicklinks": {
"new": "New Link",
"new": "Nouveau lien",
"name": "Nom",
"url": "URL",
"add": "Ajouter",
"name_error": "Must provide name",
"url_error": "Must provide URL"
"name_error": "Doit fournir le nom",
"url_error": "Doit fournir une URL"
},
"date": {
"week": "Semaine"
},
"weather": {
"not_found": "Not Found"
"not_found": "Pas trouvé"
},
"navbar": {
"tooltips": {
@ -38,8 +38,8 @@
"feedback": "Réactions"
},
"notes": {
"title": "Notes",
"placeholder": "Type here"
"title": "Remarques",
"placeholder": "Écrivez ici"
}
}
},
@ -59,57 +59,57 @@
"refresh": "Rafraîchir"
},
"settings": {
"enabled": "Enabled",
"enabled": "Activé",
"reminder": {
"title": "NOTICE",
"message": "In order for all of the changes to take place, the page must be refreshed."
"title": "REMARQUER",
"message": "Pour que toutes les modifications aient lieu, la page doit être actualisée."
},
"sections": {
"time": {
"title": "Heure",
"format": "Format",
"type": "Type",
"type": "Genre",
"digital": {
"title": "Digital",
"title": "Affichage numériquel",
"seconds": "Secondes",
"twentyfourhour": "24 heures",
"twelvehour": "12 heures",
"zero": "Complétion de zéros"
},
"analogue": {
"title": "Analogue",
"second_hand": "Seconds hand",
"minute_hand": "Minutes hand",
"hour_hand": "Hours hand",
"hour_marks": "Hour marks",
"minute_marks": "Minute marks"
"title": "Analogique",
"second_hand": "Aiguille des secondes",
"minute_hand": "Aiguille des minutes",
"hour_hand": "Aiguille de heure",
"hour_marks": "Marques d'heure",
"minute_marks": "Marques des minutes"
},
"percentage_complete": "Percentage complete",
"percentage_complete": "Pourcentage achevé",
"date": {
"title": "Date",
"week_number": "Week number",
"day_of_week": "Day of week",
"week_number": "Numéro de semaine",
"day_of_week": "Jour de la semaine",
"datenth": "Date nth",
"type": {
"short": "Short",
"short": "Courtt",
"long": "Long"
},
"short_date": "Short date",
"short_format": "Short format",
"short_date": "Date courte",
"short_format": "Format court",
"short_separator": {
"title": "Short separator",
"dots": "Dots",
"dash": "Dash",
"gaps": "Gaps",
"slashes": "Slashes"
"title": "Séparateur court",
"dots": "Points",
"dash": "Tiret",
"gaps": "Blancs",
"slashes": "Barres"
}
}
},
"quote": {
"title": "Quote",
"author_link": "Authour link",
"custom": "Custom quote",
"custom_author": "Custom authour",
"title": "Citation",
"author_link": "Lien auteur",
"custom": "Citation personnalisé",
"custom_author": "Auteur de devis personnalisé",
"buttons": {
"title": "Boutons",
"copy": "Copier",
@ -128,25 +128,25 @@
},
"background": {
"title": "Fond",
"ddg_proxy": "Use DuckDuckGo image proxy",
"transition": "Fade-in transition",
"ddg_proxy": "Utiliser le proxy d'image DuckDuckGo",
"transition": "Transition en fondu",
"category": "Catégorie",
"buttons": {
"title": "Buttons",
"title": "Boutons",
"view": "Mode vue",
"favourite": "Ajouter aux favoris",
"download": "Télécharger"
},
"effects": {
"title": "Effects",
"title": "Effets",
"blur": "Ajuster le flou",
"brightness": "Ajuster la luminosité"
},
"type": {
"title": "Type",
"api": "API",
"custom_image": "Custom image",
"custom_colour": "Custom colour/gradient"
"custom_image": "Image personnalisée",
"custom_colour": "Couleur / dégradé personnalisé"
},
"source": {
"title": "Source",
@ -156,8 +156,8 @@
"upload": "Ajouter",
"add_colour": "Ajouter une couleur",
"disabled": "Disabled",
"loop_video": "Loop video",
"mute_video": "Mute video"
"loop_video": "Boucle vidéo",
"mute_video": "Mettre la vidéo en sourdine"
}
},
"search": {
@ -167,37 +167,37 @@
"voice_search": "Recherche vocale"
},
"weather": {
"title": "Weather",
"location": "Location",
"title": "Météo",
"location": "Emplacement",
"auto": "Auto",
"temp_format": {
"title": "Temperature format",
"title": "Format de température",
"celsius": "Celsius",
"fahrenheit": "Fahrenheit",
"kelvin": "Kelvin"
},
"extra_info": {
"title": "Extra information",
"show_location": "Show Location",
"humidity": "Humidity",
"wind_speed": "Wind speed",
"min_temp": "Minimum temperature",
"max_temp": "Maximum temperature",
"atmospheric_pressure": "Atmospheric pressure"
"title": "Informations supplémentaires",
"show_location": "Afficher l'emplacement",
"humidity": "Humidité",
"wind_speed": "Vitesse du vent",
"min_temp": "Température minimale",
"max_temp": "Température maximale",
"atmospheric_pressure": "Pression atmosphérique"
}
},
"quicklinks": {
"title": "Quick Links",
"open_new": "Open in new tab",
"tooltip": "Tooltip"
"title": "Liens rapides",
"open_new": "Ouvrir dans un nouvel onglet",
"tooltip": "Info-bulle"
},
"appearance": {
"title": "Appearance",
"title": "Apparence",
"theme": {
"title": "Theme",
"title": "Thème",
"auto": "Auto",
"light": "Light",
"dark": "Dark"
"light": "Clair",
"dark": "Sombre"
},
"animations": "Animations",
"navbar": {
@ -228,62 +228,62 @@
}
},
"accessibility": {
"title": "Accessibility",
"widget_zoom": "Widget zoom",
"toast_duration": "Toast duration",
"milliseconds": "milliseconds"
"title": "Accessibilité",
"widget_zoom": "Zoom du widget",
"toast_duration": "Durée du toast",
"milliseconds": "millisecondes"
}
},
"order": {
"title": "Widget Order"
"title": "Ordre des widgets"
},
"advanced": {
"title": "Advanced",
"offline_mode": "Offline mode",
"data": "Data",
"title": "Avancée",
"offline_mode": "Mode hors-ligne",
"data": "Donnés",
"reset_modal": {
"title": "WARNING",
"question": "Do you want to reset Mue?",
"information": "This will delete all data. If you wish to keep your data and preferences, please export them first.",
"cancel": "Cancel"
"title": "ATTENTION",
"question": "Voulez-vous réinitialiser Mue?",
"information": "Cela supprimera toutes les données. Si vous souhaitez conserver vos données et préférences, veuillez d'abord les exporter.",
"cancel": "Annuler"
},
"customisation": "Customisation",
"custom_css": "Custom CSS",
"custom_js": "Custom JS",
"tab_name": "Tab name",
"experimental_warning": "Please note that the Mue team cannot provide support if you have experimental mode on. Please disable it first and see if the issue continues to occur before contacting support."
"customisation": "Personnalisation",
"custom_css": "CSS personnalisé",
"custom_js": "JS personnalisé",
"tab_name": "Nom de l'onglet",
"experimental_warning": "Veuillez noter que l'équipe Mue ne peut pas fournir d'assistance si vous avez activé le mode expérimental. Veuillez d'abord le désactiver et voir si le problème persiste avant de contacter le support."
},
"experimental": {
"title": "Experimental",
"title": "Expérimental",
"warning": "These settings have not been fully tested/implemented and may not work correctly!",
"developer": "Developer"
},
"language": {
"title": "Language",
"quote": "Quote language"
"title": "Langue",
"quote": "Citation langue"
},
"changelog": "Change Log",
"changelog": "Journal des modifications",
"about": {
"title": "About",
"copyright": "Copyright",
"title": "à propos de",
"copyright": "Droits d'auteur",
"version": {
"title": "Version",
"checking_update": "Checking for update",
"update_available": "Update available",
"no_update": "No update available",
"offline_mode": "Cannot check for update in offline mode"
"checking_update": "Vérification de la mise à jour",
"update_available": "Mise à jour disponible",
"no_update": "Pas de mise a jour disponible",
"offline_mode": "Impossible de vérifier la mise à jour en mode hors ligne"
},
"contact_us": "Contact Us",
"support_mue": "Support Mue",
"contact_us": "Nous contacter",
"support_mue": "Soutenir Mue",
"resources_used": {
"title": "Resources used",
"bg_images": "Offline background images",
"welcome_img": "Welcome image",
"pin_icon": "Pin icon"
"title": "Ressources utilisées",
"bg_images": "Images d'arrière-plan hors ligne",
"welcome_img": "Image de bienvenue",
"pin_icon": "Icône de broche"
},
"contributors": "Contributors",
"supporters": "Supporters",
"photographers": "Photographers"
"contributors": "Collaborateurs",
"supporters": "Partisans",
"photographers": "Photographes"
}
},
"buttons": {
@ -297,7 +297,7 @@
"quote_packs": "Packs Citations",
"preset_settings": "Paramètres prédéfinis",
"themes": "Thèmes",
"no_items": "No items in this category",
"no_items": "Aucun article dans cette catégorie",
"product": {
"overview": "Aperçu",
"information": "Information",
@ -328,10 +328,10 @@
}
},
"update": {
"title": "Update",
"title": "Mettre à jour",
"offline": {
"title": "Offline",
"description": "Cannot get update logs while in offline mode"
"title": "Hors",
"description": "Vous ne pouvez pas obtenir de mise à jour si vous êtes hors ligne"
},
"error": {
"title": "Erreur",
@ -341,12 +341,12 @@
"contact_support": "Contactez-nous "
},
"welcome": {
"title": "Welcome to",
"information": "Information",
"thankyoumessage1": "Thank you for installing Mue Tab,",
"thankyoumessage2": "we hope you enjoy your time with our extension.",
"support": "Support",
"close": "Close"
"title": "Bienvenue en",
"information": "Informations",
"thankyoumessage1": "Merci d'avoir installé Mue Tab,",
"thankyoumessage2": "nous espérons que vous apprécierez votre temps avec notre extension.",
"support": "Soutien",
"close": "Fermer"
},
"feedback": {
"title": "Give us feedback",
@ -361,6 +361,7 @@
},
"toasts": {
"quote": "Citation copiée",
"reset": "Réinitialisé avec succès",
"installed": "Installé avec succès",
"uninstalled": "Enlevé avec succès",
"error": "Quelque chose s'est mal passé",

View File

@ -361,6 +361,7 @@
},
"toasts": {
"quote": "Het citaat is gekopieerd",
"reset": "Het herstellen is voltooid",
"installed": "De installatie is voltooid",
"uninstalled": "Het verwijderen is voltooid",
"error": "Er is iets misgegaan",

View File

@ -361,6 +361,7 @@
},
"toasts": {
"quote": "Sitat kopiert",
"reset": "Tilbakestillte vellykket",
"installed": "Installert",
"uninstalled": "Fjernet",
"error": "Noe gikk galt",

View File

@ -361,6 +361,7 @@
},
"toasts": {
"quote": "Цитата скопирована!",
"reset": "Сброшено!",
"installed": "Успешно установлено",
"uninstalled": "Успешно удалено",
"error": "Что-то пошло не так",

View File

@ -361,6 +361,7 @@
},
"toasts": {
"quote": "名言已复制",
"reset": "重置成功",
"installed": "安装成功",
"uninstalled": "卸载成功",
"error": "发生了错误",