Skip to content

Commit

Permalink
Localize info bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Feb 7, 2022
1 parent cd1bda9 commit f590c69
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/application/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ <h4 data-loc>Save your 2FA codes to your computer for future use.</h4>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<h5 class="m-0 text-center mx-5 bar">Thanks for using Authme! <a class="text-white text-lg font-bold barLink" href="#" onclick="barLink()">Feedback</a></h5>
<a onclick="this.parentElement.style.display='none'" class="top-0.5 relative py-1 transition-colors duration-200 transform rounded-md hover:text-gray-800 cursor-pointer">
<h5 class="m-0 text-center mx-5"><span class="bar">Thanks for using Authme!</span> <a class="text-white text-lg font-bold barLink hover:text-black duration-200 ease-in" href="#" onclick="barLink()">Feedback</a></h5>
<a onclick="this.parentElement.style.display='none'" class="top-0.5 relative py-1 transition-colors duration-200 rounded-md hover:text-gray-800 cursor-pointer">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
Expand Down
30 changes: 26 additions & 4 deletions app/application/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,18 +865,32 @@ const updateRestart = () => {
}

/* info bar */
const random = Math.floor(Math.random() * 1)
const random = Math.floor(Math.random() * 3)

const infoBar = () => {
const { opens } = ipc.sendSync("statistics")
const infoBar = async () => {
const { opens } = await ipc.invoke("statistics")
const bar = document.querySelector(".bar")
const bar_link = document.querySelector(".barLink")
const info_bar = document.querySelector(".infoBar")

if (opens % 3 === 0) {
if (opens % 5 === 0) {
switch (random) {
case 0:
info_bar.style.display = "flex"
bar.textContent = lang.info_bar.feedback
bar_link.textContent = lang.info_bar.feedback_link
break

case 1:
info_bar.style.display = "flex"
bar.textContent = lang.info_bar.rate
bar_link.textContent = lang.info_bar.rate_link
break

case 2:
info_bar.style.display = "flex"
bar.textContent = lang.info_bar.translate
bar_link.textContent = lang.info_bar.translate_link
break

default:
Expand All @@ -894,6 +908,14 @@ const barLink = () => {
provideFeedback()
break

case 1:
rateAuthme()
break

case 2:
shell.openExternal("https://github.com/Levminer/authme/blob/dev/.github/CONTRIBUTING.md#translation")
break

default:
provideFeedback()
break
Expand Down
14 changes: 14 additions & 0 deletions languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,18 @@ module.exports = {
"revert_changes": "Are you sure you want to revert all current change(s)? \n\nYou will lose all current changes!",
"delete_all_codes": "Are you sure you want to delete all codes? \n\nYou can revert this with a rollback.",
},

"popup": {
"downloading_update": "Downloading update:",
"update_downloaded": "Successfully downloaded update! Please restart the app, Authme will install the updates in the background and restart automatically.",
},

"info_bar": {
"feedback": "Do you have any ideas or found a mistake?",
"feedback_link": "Feedback",
"rate": "Enjoying Authme?",
"rate_link": "Rate on Microsoft Store",
"translate": "Do you want to see Authme in another language?",
"translate_link": "Translation",
},
}
14 changes: 14 additions & 0 deletions languages/hu.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,18 @@ module.exports = {
"revert_changes": "Biztos vissza akarod vonni az összes változtatást? \n\nEzzel elveszted az összes módosítást!",
"delete_all_codes": "Biztos ki akarod törölni az össszes kódot? \n\nA visszaállításhoz töltsd be a legutolsó mentést.",
},

"popup": {
"downloading_update": "Frissítés letöltése:",
"update_downloaded": "Frissítés sikeresen letölve! Kérlek indítsd újra az alkalmazást, az Authme a háttérben telepíti a frissítést és újraindul autómatikusan.",
},

"info_bar": {
"feedback": "Van valami ötleted vagy hibát találtál?",
"feedback_link": "Visszajelzés",
"rate": "Tetszik az Authme?",
"rate_link": "Értékelés a Microsoft Store-on",
"translate": "Látni akarod az Authme-t valamilyen más nyelven?",
"translate_link": "Fordítás",
},
}
12 changes: 2 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ if (app.isPackaged === false) {
})

dev = true
} else {
const debug = require("electron-debug")

if (number.startsWith("alpha")) {
debug({
showDevTools: false,
})
}
}

/**
Expand Down Expand Up @@ -1575,8 +1567,8 @@ ipc.on("languageCode", (event) => {
/**
* Send statistics
*/
ipc.on("statistics", (event) => {
event.returnValue = settings.statistics
ipc.handle("statistics", () => {
return settings.statistics
})

/**
Expand Down
Loading

0 comments on commit f590c69

Please sign in to comment.