Browse Source

chore: fix tests and translations

pull/3183/head
Samuel Attard 1 year ago
parent
commit
78a8b26b07

+ 1
- 0
mocha.opts View File

@@ -0,0 +1 @@
--timeout 10000

+ 3
- 2
package.json View File

@@ -31,8 +31,8 @@
"pretest-electron-coverage": "cross-env NODE_ENV=coverage npm run build",
"pretest-spectron": "npm run build",
"test-electron": "npm run test-electron-main && npm run test-electron-renderer",
"test-electron-main": "electron-mocha ./test/electron/*_spec.js ./test/electron/**/*_spec.js --compilers js:babel-core/register --timeout 10000 -R spec-xunit-file",
"test-electron-renderer": "electron-mocha ./test/electron-renderer/**/**/*_spec.js ./test/electron-renderer/**/*_spec.js ./test/electron-renderer/*_spec.js --renderer --compilers js:babel-core/register --timeout 10000 -R spec-xunit-file",
"test-electron-main": "electron-mocha ./test/electron/*_spec.js ./test/electron/**/*_spec.js --compilers js:babel-core/register -R spec-xunit-file",
"test-electron-renderer": "electron-mocha ./test/electron-renderer/**/**/*_spec.js ./test/electron-renderer/**/*_spec.js ./test/electron-renderer/*_spec.js --renderer --compilers js:babel-core/register -R spec-xunit-file",
"test-electron-coverage": "npm run test-electron-main-coverage && npm run test-electron-renderer-coverage",
"test-electron-main-coverage": "cross-env NODE_ENV=coverage npm run test-electron-main -- -R test/istanbul-reporter",
"test-electron-renderer-coverage": "cross-env NODE_ENV=coverage npm run test-electron-renderer -- -R test/istanbul-reporter",
@@ -58,6 +58,7 @@
"homepage": "http://www.googleplaymusicdesktopplayer.com",
"license": "MIT",
"dependencies": {
"@slack/client": "^4.8.0",
"archiver": "^1.0.1",
"auto-launch": "^4.0.0",
"discord-rich-presence": "^0.0.7",

+ 3
- 0
src/_locales/cs.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "",
"settings-options-style-dialog-css-files": "",
"settings-options-style-dialog-all-files": "",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Výběr barvy",
"title-settings": "Nastavení",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini přehrávač",
"title-settings-style": "Vlastní motivy",
"title-settings-slack": "",

"tray-label-audio-device": "Zvukové zařízení",
"tray-label-show": "Zobrazit",

+ 3
- 0
src/_locales/da.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Indlæs CSS",
"settings-options-style-dialog-css-files": "CSS filer",
"settings-options-style-dialog-all-files": "Alle filer",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Farve vælger",
"title-settings": "Indstillinger",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini Afspiller",
"title-settings-style": "Tilpas udseende",
"title-settings-slack": "",

"tray-label-audio-device": "Lyd enheder",
"tray-label-show": "Vis",

+ 3
- 0
src/_locales/de.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "CSS laden",
"settings-options-style-dialog-css-files": "CSS-Dateien",
"settings-options-style-dialog-all-files": "Alle Dateien",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Farbauswahl",
"title-settings": "Einstellungen",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini-Player",
"title-settings-style": "Eigene Stile",
"title-settings-slack": "",

"tray-label-audio-device": "Audiogerät",
"tray-label-show": "Anzeigen",

+ 1
- 1
src/_locales/en-US.json View File

@@ -97,8 +97,8 @@
"settings-option-enable-taskbar-progress": "Show track progress in the taskbar",
"settings-option-enable-win10-media-service": "Enable the Windows 10 System Media Service",
"settings-option-enable-win10-media-service-details": "This will show the current track on the lock screen",
"settings-option-enable-win10-media-service-track-info": "Show track information in Windows 10 volume overlay",
"settings-option-discord-rich-presence": "Enable Discord Rich Presence integration",
"settings-option-enable-win10-media-service-track-info": "Show track information in Windows 10 volume overlay",
"settings-option-change-locale": "Choose language",

"settings-option-hotkey-explanation": "Default media keys will continue to work regardless of these settings. These settings are in addition to the defaults.",

+ 3
- 0
src/_locales/es-ES.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Cargar CSS",
"settings-options-style-dialog-css-files": "Ficheros CSS",
"settings-options-style-dialog-all-files": "Todos los Ficheros",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Selector de Color",
"title-settings": "Ajustes",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Reproductor Mini",
"title-settings-style": "Estilos Personalizados",
"title-settings-slack": "",

"tray-label-audio-device": "Dispositivo de Audio",
"tray-label-show": "Mostrar",

+ 3
- 0
src/_locales/fr-FR.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Charger le CSS",
"settings-options-style-dialog-css-files": "Fichiers CSS",
"settings-options-style-dialog-all-files": "Tous les fichiers",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Sélecteur de couleur",
"title-settings": "Paramètres",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini Lecteur",
"title-settings-style": "Styles Personnalisés",
"title-settings-slack": "",

"tray-label-audio-device": "Controlleur Audio",
"tray-label-show": "Montrer",

+ 3
- 0
src/_locales/hu.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "CSS betöltése",
"settings-options-style-dialog-css-files": "CSS Fájlok",
"settings-options-style-dialog-all-files": "Összes fájl",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Színpaletta",
"title-settings": "Beállítások",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini Lejátszó",
"title-settings-style": "Egyéni stílusok",
"title-settings-slack": "",

"tray-label-audio-device": "Audio eszköz",
"tray-label-show": "Mutassa",

+ 4
- 1
src/_locales/it.json View File

@@ -97,8 +97,8 @@
"settings-option-enable-taskbar-progress": "Mostra il progresso del brano nella barra delle applicazioni",
"settings-option-enable-win10-media-service": "Abilita il System Media Service di Windows 10",
"settings-option-enable-win10-media-service-details": "Mostra il brano corrente nella schermata di blocco",
"settings-option-enable-win10-media-service-track-info": "Mostra le informazioni del brano nell'indicatore del volume di Windows 10",
"settings-option-discord-rich-presence": "Abilita l'integrazione di Discord Rich Presence",
"settings-option-enable-win10-media-service-track-info": "Mostra le informazioni del brano nell'indicatore del volume di Windows 10",
"settings-option-change-locale": "Seleziona lingua",

"settings-option-hotkey-explanation": "I tasti multimediali predefiniti continueranno a funzionare indipendentemente da queste impostazioni. Queste sono in aggiunta alle impostazioni predefinite.",
@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Carica CSS",
"settings-options-style-dialog-css-files": "File CSS",
"settings-options-style-dialog-all-files": "Tutti i file",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Selettore del colore",
"title-settings": "Impostazioni",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini Player",
"title-settings-style": "Stili personalizzati",
"title-settings-slack": "",

"tray-label-audio-device": "Dispositivo audio",
"tray-label-show": "Mostra",

+ 3
- 0
src/_locales/ja.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "CSSを読み込む",
"settings-options-style-dialog-css-files": "CSSファイル",
"settings-options-style-dialog-all-files": "全てのファイル",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "カラーピッカー",
"title-settings": "設定",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "ミニプレーヤー",
"title-settings-style": "カスタムスタイル",
"title-settings-slack": "",

"tray-label-audio-device": "オーディオデバイス",
"tray-label-show": "手前に表示",

+ 4
- 1
src/_locales/nl-NL.json View File

@@ -97,8 +97,8 @@
"settings-option-enable-taskbar-progress": "Toon voortgang nummer in taakbalk",
"settings-option-enable-win10-media-service": "Windows 10 System Media Service inschakelen",
"settings-option-enable-win10-media-service-details": "Dit toont het huidige nummer op het vergrendelingsscherm",
"settings-option-enable-win10-media-service-track-info": "Toon nummerinformatie in het volume-overlay",
"settings-option-discord-rich-presence": "Discord Rich Presence inschakelen",
"settings-option-enable-win10-media-service-track-info": "Toon nummerinformatie in het volume-overlay",
"settings-option-change-locale": "Taal kiezen",

"settings-option-hotkey-explanation": "Standaardmediatoetsen zullen blijven werken, onafhankelijk van deze instellingen. Deze instellingen zijn een toevoeging aan de standaardinstellingen.",
@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Css laden",
"settings-options-style-dialog-css-files": "Css-bestanden",
"settings-options-style-dialog-all-files": "Alle bestanden",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Kleurenkiezer",
"title-settings": "Instellingen",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini-speler",
"title-settings-style": "Aangepaste stijlen",
"title-settings-slack": "",

"tray-label-audio-device": "Audioapparaat",
"tray-label-show": "Tonen",

+ 3
- 0
src/_locales/pirate.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "",
"settings-options-style-dialog-css-files": "",
"settings-options-style-dialog-all-files": "",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Paint Picker",
"title-settings": "",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Small Player",
"title-settings-style": "Custom ship",
"title-settings-slack": "",

"tray-label-audio-device": "",
"tray-label-show": "",

+ 3
- 0
src/_locales/pl-PL.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Załaduj plik CSS",
"settings-options-style-dialog-css-files": "Pliki CSS",
"settings-options-style-dialog-all-files": "Wszystkie pliki",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Wybierz kolor",
"title-settings": "Ustawienia",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini odtwarzacz",
"title-settings-style": "Własne style",
"title-settings-slack": "",

"tray-label-audio-device": "Urządzenie Audio",
"tray-label-show": "Pokaż",

+ 3
- 0
src/_locales/pt-BR.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Carregar CSS",
"settings-options-style-dialog-css-files": "Arquivos CSS",
"settings-options-style-dialog-all-files": "Todos os arquivos",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Paleta de cores",
"title-settings": "Configurações",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini Player",
"title-settings-style": "Estilos personalizados",
"title-settings-slack": "",

"tray-label-audio-device": "Dispositivo de áudio",
"tray-label-show": "Mostrar",

+ 3
- 0
src/_locales/ro.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Încarcă CSS",
"settings-options-style-dialog-css-files": "Fișiere CSS",
"settings-options-style-dialog-all-files": "Toate fișierele",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Paletă culori",
"title-settings": "Setări",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Player mini",
"title-settings-style": "Stiluri personalizate",
"title-settings-slack": "",

"tray-label-audio-device": "Dispozitiv audio",
"tray-label-show": "Arată",

+ 4
- 1
src/_locales/ru.json View File

@@ -97,8 +97,8 @@
"settings-option-enable-taskbar-progress": "Показывать позицию воспроизведения в панели задач",
"settings-option-enable-win10-media-service": "Включить поддержку медиасервиса Windows 10",
"settings-option-enable-win10-media-service-details": "Информация о текущем треке будет выводиться на экране блокировки",
"settings-option-enable-win10-media-service-track-info": "Показывать информацию о текущем треке рядом со всплывающим индикатором громкости Windows 10",
"settings-option-discord-rich-presence": "Включить поддержку Discord Rich Presence",
"settings-option-enable-win10-media-service-track-info": "Показывать информацию о текущем треке рядом со всплывающим индикатором громкости Windows 10",
"settings-option-change-locale": "Язык программы",

"settings-option-hotkey-explanation": "Стандартные мультимедийные кнопки всё равно будут работать, независимо от дополнительных, представленных ниже.",
@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Загрузить CSS",
"settings-options-style-dialog-css-files": "Файлы CSS",
"settings-options-style-dialog-all-files": "Все файлы",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Выбор цвета",
"title-settings": "Настройки программы",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Миниплеер",
"title-settings-style": "Свои стили",
"title-settings-slack": "",

"tray-label-audio-device": "Аудио устройство",
"tray-label-show": "Развернуть",

+ 3
- 0
src/_locales/sk.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Načítať CSS",
"settings-options-style-dialog-css-files": "CSS súbory",
"settings-options-style-dialog-all-files": "Všetky súbory",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Výber farby",
"title-settings": "Nastavenia",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Mini prehrávač",
"title-settings-style": "Vlastné štýly",
"title-settings-slack": "",

"tray-label-audio-device": "Prehrávacie zariadenie",
"tray-label-show": "Zobraziť",

+ 4
- 1
src/_locales/sv.json View File

@@ -60,7 +60,6 @@
"modal-goToURL-title": "Skriv in Google Play-adressen:",
"modal-welcome-title": "Välkommen til version",
"modal-welcome-content": "Vi hoppas att du gillar den nya uppdateringen!",
"playback-label-im-feeling-lucky": "",

"playback-label-next-track": "Nästa låt",
"playback-label-play-pause": "Spela / Pausa",
@@ -72,6 +71,7 @@
"playback-label-volume-up": "Sänk volym",
"playback-label-info-track": "Meddela nuvarande låt",
"playback-os-no-track-playing": "Ingen låt spelas",
"playback-label-im-feeling-lucky": "",

"settings-requires-restart": "Kräver omstart av GPMDP",

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Ladda CSS",
"settings-options-style-dialog-css-files": "CSS-filer",
"settings-options-style-dialog-all-files": "Alla filer",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Färgväljare",
"title-settings": "Inställningar",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Miniuppspelare",
"title-settings-style": "Anpassa utseende",
"title-settings-slack": "",

"tray-label-audio-device": "Ljudenheter",
"tray-label-show": "Visa",

+ 3
- 0
src/_locales/ua.json View File

@@ -131,6 +131,8 @@
"settings-options-style-dialog-button": "Завантажити CSS",
"settings-options-style-dialog-css-files": "Файл CSS",
"settings-options-style-dialog-all-files": "Всі файли",
"slack-token-label": "",
"slack-token-placeholder": "",

"title-color-picker": "Обрати колір",
"title-settings": "Налаштування",
@@ -141,6 +143,7 @@
"title-settings-listenbrainz": "ListenBrainz",
"title-settings-mini": "Мініплеер",
"title-settings-style": "Власні стилі",
"title-settings-slack": "",

"tray-label-audio-device": "Звуковий пристрій",
"tray-label-show": "Показати",

+ 3
- 3
src/main/features/core/desktopSettings.js View File

@@ -36,9 +36,9 @@ export const showColorWheel = () => {
return;
}
const colorWheel = new BrowserWindow({
width: 400,
minWidth: 400,
maxWidth: 400,
width: 460,
minWidth: 460,
maxWidth: 460,
height: 400,
minHeight: 400,
maxHeight: 400,

+ 11
- 3
test/electron/jsonCreator_spec.js View File

@@ -25,6 +25,8 @@ describe('JSONCreator', () => {
});

describe('when an old JSON file exists', () => {
let jsonPath;

// Old path var
const oldPath = (process.env.APPDATA || // eslint-disable-line
(process.platform === 'darwin' ? process.env.HOME + '/Library/Preferences' : os.homedir())) + // eslint-disable-line
@@ -35,18 +37,24 @@ describe('JSONCreator', () => {
fs.writeFileSync(`${oldPath}/test.json`, JSON.stringify({ test: 123 }), 'utf8');
});

afterEach(() => {
if (jsonPath && fs.existsSync(jsonPath)) {
fs.unlinkSync(jsonPath);
}
});

it('should preserve the old file', () => {
const jsonPath = jsonCreator('test');
jsonPath = jsonCreator('test');
jsonPath.should.be.a.file();
});

it('should preserve the contents of the old file', () => {
const jsonPath = jsonCreator('test');
jsonPath = jsonCreator('test');
jsonPath.should.have.content('{"test":123}');
});

it('should delete the old JSON directory', () => {
jsonCreator('test');
jsonPath = jsonCreator('test');

fs.existsSync(oldPath).should.be.equal(false);
});

+ 3
- 5
vendor/update-translations.js View File

@@ -3,7 +3,7 @@ const path = require('path');

const locales = path.resolve(__dirname, '../src/_locales');

const targetLines = fs.readFileSync(path.resolve(locales, 'en-US.json'), 'utf8').split('\n');
const targetLines = fs.readFileSync(path.resolve(locales, 'en-US.json'), 'utf8').split(/\r?\n/g);

const keyTest = () => /"(.+)":/gi;

@@ -13,7 +13,6 @@ for (let i = 0; i < targetLines.length; i++) {
targetKeys.push(keyTest().exec(targetLines[i])[1]);
}


fs.readdirSync(locales).forEach((fileName) => {
const needToAdd = [];
const filePath = path.resolve(locales, fileName);
@@ -21,16 +20,15 @@ fs.readdirSync(locales).forEach((fileName) => {
if (fileName.endsWith('.json') && fileName !== 'en-US.json') {
const content = fs.readFileSync(filePath, 'utf8');

let lines = content.split('\n');
let lines = content.split(/\r?\n/g);
let keyI = 0;
let offset = 0;
for (let i = 0; i < lines.length; i++) {
if (lines[i].trim() === '{' || lines[i].trim() === '}' || !lines[i].trim()) continue;
console.log(lines[i]);
const key = keyTest().exec(lines[i])[1];
if (key !== targetKeys[keyI]) {
needToAdd.push([i + offset, targetKeys[keyI]]);
keyI++;
i--;
offset++;
}
keyI++;

+ 159
- 1284
yarn.lock
File diff suppressed because it is too large
View File


Loading…
Cancel
Save