add i18n to lastfm button

This commit is contained in:
vapormusic 2022-01-25 20:52:21 +07:00
parent 6774926b6a
commit 2108dd5975
2 changed files with 7 additions and 4 deletions

View file

@ -70,6 +70,9 @@
"term.enabled": "Enabled", "term.enabled": "Enabled",
"term.disabled": "Disabled", "term.disabled": "Disabled",
"term.connect": "Connect", "term.connect": "Connect",
"term.disconnect": "Disconnect",
"term.authed": "Authed",
"term.connecting": "Connecting",
"term.confirm": "Confirm ?", "term.confirm": "Confirm ?",
"term.more": "More", "term.more": "More",
"term.less": "Less", "term.less": "Less",

View file

@ -3296,12 +3296,12 @@ const app = new Vue({
const element = document.getElementById('lfmConnect'); const element = document.getElementById('lfmConnect');
// new key : f9986d12aab5a0fe66193c559435ede3 // new key : f9986d12aab5a0fe66193c559435ede3
window.open('https://www.last.fm/api/auth?api_key=f9986d12aab5a0fe66193c559435ede3&cb=cider://auth/lastfm'); window.open('https://www.last.fm/api/auth?api_key=f9986d12aab5a0fe66193c559435ede3&cb=cider://auth/lastfm');
element.innerText = 'Connecting...'; element.innerText = app.getLz('term.connecting') + '...';
/* Just a timeout for the button */ /* Just a timeout for the button */
setTimeout(() => { setTimeout(() => {
if (element.innerText === 'Connecting...') { if (element.innerText === app.getLz('term.connecting') +'...') {
element.innerText = 'Connect'; element.innerText = app.getLz('term.connect');
console.warn('[LastFM] Attempted connection timed out.'); console.warn('[LastFM] Attempted connection timed out.');
} }
}, 20000); }, 20000);
@ -3309,7 +3309,7 @@ const app = new Vue({
ipcRenderer.on('LastfmAuthenticated', function(_event, lfmAuthKey) { ipcRenderer.on('LastfmAuthenticated', function(_event, lfmAuthKey) {
app.cfg.lastfm.auth_token = lfmAuthKey; app.cfg.lastfm.auth_token = lfmAuthKey;
app.cfg.lastfm.enabled = true; app.cfg.lastfm.enabled = true;
element.innerHTML = `Disconnect\n<p style="font-size: 8px"><i>(Authed: ${lfmAuthKey})</i></p>`; element.innerHTML = `${app.getLz('term.disconnect')}\n<p style="font-size: 8px"><i>(${app.getLz('term.authed')}: ${lfmAuthKey})</i></p>`;
element.onclick = app.LastFMDeauthorize; element.onclick = app.LastFMDeauthorize;
}); });
}, },