From 7df90a65346bf87dfb865c55d042e089dccd2a2d Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Tue, 26 Nov 2024 12:32:08 +0000 Subject: [PATCH] Added translations for "What species are detected" --- js/i18n.js | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++- js/ui.js | 61 +++++++++++------ 2 files changed, 236 insertions(+), 20 deletions(-) diff --git a/js/i18n.js b/js/i18n.js index 2a0e05d..9cf6c25 100644 --- a/js/i18n.js +++ b/js/i18n.js @@ -2160,6 +2160,199 @@ zh: ` ` } +const i18nSpeciesList = { + da: { + title: 'Aktuel artsliste', + includedButton: 'Inkluderet', + excludedButton: 'Ekskluderet', + cname: 'Almindeligt navn', + sname: 'Videnskabeligt navn', + localBirds: ' begrænset til lokale fugle', + week: '. Den aktuelle fil blev gemt i uge ${week}', + weekSpecific: 'uge-specifik', + threshold: '${weekSpecific} artsfiltergrænse på ${speciesThreshold}', + location: ' fokuseret på ${place}, med en ${species_filter_text}${current_file_text}', + depending: ', afhængigt af datoen for den fil, du analyserer', + upTo: ' op til ', + included: '

Antallet af opdagede arter afhænger af modellen, den anvendte liste og i tilfælde af lokalitetsfilteret af artsfiltergrænsen og muligvis den uge, optagelsen blev lavet.

\ + Du bruger modellen ${model} og listen ${listInUse}${localBirdsOnly}${location_filter_text}. Med disse indstillinger vil Chirpity vise detektioner for ${upTo} \ + ${count} klasser${depending}:

\ + ${includedList}
Almindeligt navnVidenskabeligt navn
', + excluded: '

Omvendt vil applikationen ikke vise detektioner blandt følgende ${excludedCount} klasser:

${excludedList}
${cname}${sname}
' + }, + de: { + title: 'Aktuelle Artenliste', + includedButton: 'Eingeschlossen', + excludedButton: 'Ausgeschlossen', + cname: 'Trivialname', + sname: 'Wissenschaftlicher Name', + localBirds: ' beschränkt auf lokale Vögel', + week: '. Die aktuelle Datei wurde in Woche ${week} gespeichert', + weekSpecific: 'wochen-spezifisch', + threshold: '${weekSpecific} Artenfiltergrenze von ${speciesThreshold}', + location: ' fokussiert auf ${place}, mit einem ${species_filter_text}${current_file_text}', + depending: ', abhängig vom Datum der Datei, die Sie analysieren', + upTo: ' bis zu ', + included: '

Die Anzahl der erkannten Arten hängt vom Modell, der verwendeten Liste und im Falle des Standortfilters von der Artenfiltergrenze und möglicherweise der Woche ab, in der die Aufnahme gemacht wurde.

\ + Sie verwenden das Modell ${model} und die Liste ${listInUse}${localBirdsOnly}${location_filter_text}. Mit diesen Einstellungen zeigt Chirpity Erkennungen für bis zu \ + ${count} Klassen${depending}:

\ + ${includedList}
TrivialnameWissenschaftlicher Name
', + excluded: '

Umgekehrt zeigt die Anwendung keine Erkennungen unter den folgenden ${excludedCount} Klassen an:

${excludedList}
${cname}${sname}
' + }, + en: { + title: 'Current Species List', + includedButton: 'Included', + excludedButton: 'Excluded', + cname: 'Common Name', + sname: 'Scientific Name', + localBirds: ' limited to local birds', + week: '. The current file was saved in week ${week}', + weekSpecific: 'week-specific', + threshold: '${weekSpecific} species filter threshold of ${speciesThreshold}', + location: ' focused on ${place}, with a ${species_filter_text}${current_file_text}', + depending: ', depending on the date of the file you analyse', + upTo: ' up to ', + included: '

The number of species detected depends on the model, the list being used and in the case of the location filter, the species filter threshold and possibly the week in which the recording was made.

\ + You are using the ${model} model and the ${listInUse} list${localBirdsOnly}${location_filter_text}. With these settings, Chirpity will display detections for ${upTo} \ + ${count} classes${depending}:

\ + ${includedList}
Common NameScientific Name
', + excluded: '

Conversely, the application will not display detections among the following ${excludedCount} classes:

${excludedList}
${cname}${sname}
' + }, + es: { + title: 'Lista actual de especies', + includedButton: 'Incluido', + excludedButton: 'Excluido', + cname: 'Nombre común', + sname: 'Nombre científico', + localBirds: ' limitado a aves locales', + week: '. El archivo actual se guardó en la semana ${week}', + weekSpecific: 'específico por semana', + threshold: 'umbral de filtro de especies ${weekSpecific} de ${speciesThreshold}', + location: ' centrado en ${place}, con un ${species_filter_text}${current_file_text}', + depending: ', dependiendo de la fecha del archivo que analices', + upTo: ' hasta ', + included: '

El número de especies detectadas depende del modelo, la lista utilizada y, en el caso del filtro de ubicación, del umbral del filtro de especies y posiblemente de la semana en que se realizó la grabación.

\ + Estás utilizando el modelo ${model} y la lista ${listInUse}${localBirdsOnly}${location_filter_text}. Con estas configuraciones, Chirpity mostrará detecciones para hasta \ + ${count} clases${depending}:

\ + ${includedList}
Nombre comúnNombre científico
', + excluded: '

Por el contrario, la aplicación no mostrará detecciones entre las siguientes ${excludedCount} clases:

${excludedList}
${cname}${sname}
' + }, + fr: { + title: 'Liste actuelle des espèces', + includedButton: 'Inclus', + excludedButton: 'Exclus', + cname: 'Nom commun', + sname: 'Nom scientifique', + localBirds: ' limité aux oiseaux locaux', + week: '. Le fichier actuel a été enregistré lors de la semaine ${week}', + weekSpecific: 'filtre d’espèces spécifique à la semaine', + threshold: 'seuil du filtre d’espèces spécifique à la semaine de ${speciesThreshold}', + location: ' centré sur ${place}, avec un ${species_filter_text}${current_file_text}', + depending: ', selon la date du fichier que vous analysez', + upTo: ' jusqu’à ', + included: '

Le nombre d’espèces détectées dépend du modèle, de la liste utilisée et, dans le cas du filtre de localisation, du seuil du filtre d’espèces et éventuellement de la semaine dans laquelle l’enregistrement a été réalisé.

\ + Vous utilisez le modèle ${model} et la liste ${listInUse}${localBirdsOnly}${location_filter_text}. Avec ces paramètres, Chirpity affichera les détections pour ${upTo} \ + ${count} classes${depending} :

\ + ${includedList}
Nom communNom scientifique
', + excluded: '

En revanche, l’application n’affichera pas de détections parmi les ${excludedCount} classes suivantes :

${excludedList}
${cname}${sname}
' + }, + nl: { + title: 'Huidige soortenlijst', + includedButton: 'Inbegrepen', + excludedButton: 'Uitgesloten', + cname: 'Gewone naam', + sname: 'Wetenschappelijke naam', + localBirds: ' beperkt tot lokale vogels', + week: '. Het huidige bestand is opgeslagen in week ${week}', + weekSpecific: 'week-specifiek', + threshold: 'drempelwaarde voor soortenfilter specifiek voor de week van ${speciesThreshold}', + location: ' gericht op ${place}, met een ${species_filter_text}${current_file_text}', + depending: ', afhankelijk van de datum van het bestand dat u analyseert', + upTo: ' tot ', + included: '

Het aantal gedetecteerde soorten hangt af van het model, de gebruikte lijst en in het geval van de locatiefilter van de drempelwaarde voor soortenfilters en mogelijk de week waarin de opname is gemaakt.

\ + U gebruikt het ${model}-model en de ${listInUse}-lijst${localBirdsOnly}${location_filter_text}. Met deze instellingen toont Chirpity detecties voor ${upTo} \ + ${count} klassen${depending}:

\ + ${includedList}
Gewone naamWetenschappelijke naam
', + excluded: '

Daarentegen zal de applicatie geen detecties weergeven van de volgende ${excludedCount} klassen:

${excludedList}
${cname}${sname}
' + }, + pt: { + title: 'Lista Atual de Espécies', + includedButton: 'Incluído', + excludedButton: 'Excluído', + cname: 'Nome Comum', + sname: 'Nome Científico', + localBirds: ' limitado a aves locais', + week: '. O arquivo atual foi salvo na semana ${week}', + weekSpecific: 'filtro de espécies específico da semana', + threshold: 'limite do filtro de espécies específico da semana de ${speciesThreshold}', + location: ' focado em ${place}, com um ${species_filter_text}${current_file_text}', + depending: ', dependendo da data do arquivo que você analisa', + upTo: ' até ', + included: '

O número de espécies detectadas depende do modelo, da lista utilizada e, no caso do filtro de localização, do limite do filtro de espécies e possivelmente da semana em que a gravação foi feita.

\ + Você está usando o modelo ${model} e a lista ${listInUse}${localBirdsOnly}${location_filter_text}. Com essas configurações, o Chirpity exibirá detecções para ${upTo} \ + ${count} classes${depending}:

\ + ${includedList}
Nome ComumNome Científico
', + excluded: '

Por outro lado, o aplicativo não exibirá detecções entre as seguintes ${excludedCount} classes:

${excludedList}
${cname}${sname}
' + }, + ru: { + title: 'Текущий список видов', + includedButton: 'Включено', + excludedButton: 'Исключено', + cname: 'Обычное название', + sname: 'Научное название', + localBirds: ' ограничено местными птицами', + week: '. Текущий файл был сохранён на неделе ${week}', + weekSpecific: 'недельный фильтр видов', + threshold: 'порог фильтра видов на неделе ${speciesThreshold}', + location: ' ориентирован на ${place}, с ${species_filter_text}${current_file_text}', + depending: ', в зависимости от даты файла, который вы анализируете', + upTo: ' до ', + included: '

Количество обнаруженных видов зависит от модели, используемого списка и, в случае фильтра по местоположению, порога фильтра видов и, возможно, недели, в которой была сделана запись.

\ + Вы используете модель ${model} и список ${listInUse}${localBirdsOnly}${location_filter_text}. С этими настройками Chirpity покажет обнаружения для ${upTo} \ + ${count} классов${depending}:

\ + ${includedList}
Обычное названиеНаучное название
', + excluded: '

В то же время, приложение не будет показывать обнаружения среди следующих ${excludedCount} классов:

${excludedList}
${cname}${sname}
' + }, + sv: { + title: 'Aktuell artslista', + includedButton: 'Inkluderad', + excludedButton: 'Exkluderad', + cname: 'Vanligt namn', + sname: 'Vetenskapligt namn', + localBirds: ' begränsad till lokala fåglar', + week: '. Den aktuella filen sparades under vecka ${week}', + weekSpecific: 'vecko-specifik', + threshold: 'vecko-specifik artfiltergräns på ${speciesThreshold}', + location: ' fokuserad på ${place}, med en ${species_filter_text}${current_file_text}', + depending: ', beroende på datumet för filen du analyserar', + upTo: ' upp till ', + included: '

Antalet detekterade arter beror på modellen, den använda listan och, i fallet med platsfiltret, artfiltergränsen och eventuellt veckan då inspelningen gjordes.

\ + Du använder modellen ${model} och listan ${listInUse}${localBirdsOnly}${location_filter_text}. Med dessa inställningar kommer Chirpity att visa detektioner för ${upTo} \ + ${count} klasser${depending}:

\ + ${includedList}
Vanligt namnVetenskapligt namn
', + excluded: '

Å andra sidan kommer applikationen inte att visa detektioner bland följande ${excludedCount} klasser:

${excludedList}
${cname}${sname}
' + }, + zh: { + title: '当前物种列表', + includedButton: '包含', + excludedButton: '排除', + cname: '常见名称', + sname: '学名', + localBirds: ' 限制为本地鸟类', + week: '。当前文件保存于第 ${week} 周', + weekSpecific: '特定周的', + threshold: '${speciesThreshold} 的特定周物种过滤阈值', + location: ' 专注于 ${place},包含 ${species_filter_text}${current_file_text}', + depending: ',具体取决于您分析的文件日期', + upTo: ' 高达 ', + included: '

检测到的物种数量取决于模型、使用的列表,在位置过滤的情况下,还取决于物种过滤阈值以及录音的周数。

\ + 您正在使用 ${model} 模型和 ${listInUse} 列表${localBirdsOnly}${location_filter_text}。根据这些设置,Chirpity 将显示最多 ${upTo} \ + ${count} 类别的检测结果${depending}:

\ + ${includedList}
常见名称学名
', + excluded: '

另一方面,应用程序不会显示以下 ${excludedCount} 类别的检测结果:

${excludedList}
${cname}${sname}
' + } +}; + async function localiseUI(locale) { let t0 = Date.now(); @@ -2281,4 +2474,4 @@ async function localiseUI(locale) { console.error('Localisation Error:', error.message); } } -export {i18nHeadings, i18nContext, i18nLocation, i18nForm, i18nHelp, i18nToasts, i18nTitles, i18nLIST_MAP, localiseUI} \ No newline at end of file +export {i18nSpeciesList,i18nHeadings, i18nContext, i18nLocation, i18nForm, i18nHelp, i18nToasts, i18nTitles, i18nLIST_MAP, i18nLists, localiseUI} \ No newline at end of file diff --git a/js/ui.js b/js/ui.js index 12d0008..7226e14 100644 --- a/js/ui.js +++ b/js/ui.js @@ -1,7 +1,7 @@ import {trackVisit, trackEvent} from './tracking.js'; import {DOM} from './DOMcache.js'; import {IUCNCache} from './IUCNcache.js'; -import {i18nHeadings, localiseUI, i18nContext, i18nLocation, i18nForm, i18nHelp, i18nToasts, i18nTitles, i18nLIST_MAP} from './i18n.js'; +import {i18nSpeciesList,i18nHeadings, localiseUI, i18nContext, i18nLocation, i18nForm, i18nHelp, i18nToasts, i18nTitles, i18nLIST_MAP, i18nLists} from './i18n.js'; let LOCATIONS, locationID = undefined, loadingTimeout, LIST_MAP; let LABELS = [], DELETE_HISTORY = []; @@ -3818,33 +3818,55 @@ function formatDuration(seconds){ } const populateSpeciesModal = async (included, excluded) => { - const count = included.length; - const current_file_text = STATE.week !== -1 && STATE.week ? `. The current file was saved in week ${STATE.week}` : ''; - const model = config.model === 'birdnet' ? 'BirdNET' : 'Chirpity'; - const localBirdsOnly = config.local && config.model === 'birdnet' && config.list === 'nocturnal' ? ' limited to local birds' : ''; - const species_filter_text = config.useWeek && config.list === 'location' ? `week-specific species filter threshold of ${config.speciesThreshold}` : config.list === 'location' ? `species filter threshold of ${config.speciesThreshold}` : ''; - const location_filter_text = config.list === 'location' ? ` focused on ${place.textContent.replace('fmd_good', '')}, with a ${species_filter_text}${current_file_text}` : ''; - let includedContent = `

The number of species detected depends on the model, the list being used and in the case of the location filter, the species filter threshold and possibly the week in which the recording was made.

- You are using the ${model} model and the ${config.list} list${localBirdsOnly}${location_filter_text}. With these settings, Chirpity will display detections for ${config.useWeek && config.list === 'location' && (STATE.week === -1 || !STATE.week ) ? 'up to' : ''} - ${count} classes${config.useWeek && config.list === 'location' && (STATE.week === -1 || !STATE.week ) ? ', depending on the date of the file you analyse' : ''}:

`; - includedContent += '\n'; - includedContent += generateBirdIDList(included); - includedContent += '
Common NameScientific Name
\n'; + let locale = config[config.model].locale; + locale = i18nSpeciesList[locale] ? locale : 'en'; // coerce locale to one that exists + const i18n = i18nSpeciesList[locale]; + const current_file_text = STATE.week !== -1 && STATE.week ? interpolate(i18n.week, {week: STATE.week}) : ''; + const model = config.model === 'birdnet' ? 'BirdNET' : 'Nocmig'; + const localBirdsOnly = config.local && config.model === 'birdnet' && config.list === 'nocturnal' ? i18n.localBirds : ''; + let species_filter_text = '', location_filter_text = ''; + if (config.list === 'location'){ + const weekSpecific = config.useWeek ? i18n.weekSpecific : ''; + species_filter_text = interpolate(i18n.threshold, {weekSpecific: weekSpecific, speciesThreshold: config.speciesThreshold}); + location_filter_text = interpolate(i18n.location, {place: place.textContent.replace('fmd_good', ''), current_file_text: current_file_text, species_filter_text: species_filter_text}); + } + + //const species_filter_text = config.useWeek && config.list === 'location' ? `week-specific species filter threshold of ${config.speciesThreshold}` : config.list === 'location' ? `species filter threshold of ${config.speciesThreshold}` : ''; + + //const location_filter_text = config.list === 'location' ? ` focused on ${place.textContent.replace('fmd_good', '')}, with a ${species_filter_text}${current_file_text}` : ''; + + // let includedContent = `

The number of species detected depends on the model, the list being used and in the case of the location filter, the species filter threshold and possibly the week in which the recording was made.

+ // You are using the ${model} model and the ${config.list} list${localBirdsOnly}${location_filter_text}. With these settings, Chirpity will display detections for ${config.useWeek && config.list === 'location' && (STATE.week === -1 || !STATE.week ) ? 'up to' : ''} + // ${count} classes${config.useWeek && config.list === 'location' && (STATE.week === -1 || !STATE.week ) ? ', depending on the date of the file you analyse' : ''}:

`; + //includedContent += '\n'; + // includedContent += generateBirdIDList(included); + //includedContent += '
Common NameScientific Name
\n'; + const includedList = generateBirdIDList(included); + const depending = config.useWeek && config.list === 'location' && (STATE.week === -1 || !STATE.week ) ? i18n.depending : ''; + const includedContent = interpolate(i18n.included, + {model: model, + listInUse: i18nLists[locale][config.list], + location_filter_text: location_filter_text, + localBirdsOnly: localBirdsOnly, + upTo: i18n.upTo, + count: included.length, + depending: depending, + includedList: includedList}) let excludedContent = '', disable = ''; if (excluded){ - excludedContent += `

Conversely, the application will not display detections among the following ${excluded.length} classes:

\n`; - excludedContent += generateBirdIDList(excluded); - excludedContent += '
Common NameScientific Name
\n'; + const excludedList = generateBirdIDList(excluded); + + excludedContent = interpolate(i18n.excluded, {excludedList: excludedList, excludedCount: excluded.length, cname: i18n.cname, sname: i18n.sname }) } else { disable = ' disabled' } let modalContent = `
@@ -3853,6 +3875,7 @@ function formatDuration(seconds){
`; document.getElementById('speciesModalBody').innerHTML = modalContent; + document.getElementById('speciesModalLabel').textContent = i18n.title; const species = new bootstrap.Modal(document.getElementById('speciesModal')); species.show(); STATE.includedList = included; @@ -4834,7 +4857,7 @@ function playRegion(){ if (! config.useWeek) STATE.week = -1; worker.postMessage({action:'update-state', useWeek: config.useWeek}); - updateList() + updateList(); break } case 'list-to-use': { setListUIState(element.value)