Skip to content

Commit

Permalink
Improve localization
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Apr 15, 2022
1 parent b194022 commit d3fbc0f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 25 deletions.
10 changes: 4 additions & 6 deletions app/import/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ <h4 data-loc>List of the currently supported QR codes. You can import from more
<div class="my-3 ml-3 mr-1.5 flex w-1/2 flex-wrap items-center justify-center rounded-2xl bg-gray-700 p-4">
<h4 data-loc class="m-0 mb-3">TOTP 2FA QR code</h4>
<h5 data-loc class="m-0">A TOTP QR code is that you find mostly everywhere, if you want to setup 2FA.</h5>
<h5 data-loc class="m-0">Example: (Google, Facebook, Microsoft).</h5>
<h5 data-loc class="m-0">Starts with: (otpauth://totp/).</h5>
<h5 data-loc class="m-0">Example: Google, Facebook, Microsoft, etc.</h5>
<a data-loc class="link pt-3 !text-lg" href="#totp" onclick="totpLink()">Detailed steps</a>
</div>
<div class="my-3 mr-3 ml-1.5 flex w-1/2 flex-wrap items-center justify-center rounded-2xl bg-gray-700 p-4">
<h4 data-loc class="m-0 mb-3">Migration 2FA QR code</h4>
<h5 data-loc class="m-0">A migration QR code is what you can export, and contains all of your already imported codes.</h5>
<h5 data-loc class="m-0">Example: (Google Authenticator).</h5>
<h5 data-loc class="m-0">Starts with: (otpauth-migration://).</h5>
<h4 data-loc class="m-0 mb-3">Google Authenticator 2FA QR code</h4>
<h5 data-loc class="m-0">A Google Authenticator code is what you can export, and contains all of your already imported codes.</h5>
<h5 data-loc class="m-0">Example: Google Authenticator.</h5>
<a data-loc class="link pt-3 !text-lg" href="#migration" onclick="migrationLink()">Detailed steps</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<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>
<span data-loc>About</span>
<span data-loc>Version</span>
</button>
</div>
</div>
Expand Down
10 changes: 4 additions & 6 deletions languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,12 @@ module.exports = {
"List of the currently supported QR codes. You can import from more types at the same time.",
"Examples",
"TOTP 2FA QR code",
"A TOTP QR code is that you find mostly everywhere if you want to setup 2FA.",
"Example: (Google, Facebook, Microsoft).",
"Starts with: (otpauth://totp/).",
"A TOTP QR code is that you find mostly everywhere, if you want to setup 2FA.",
"Example: Google, Facebook, Microsoft, etc.",
"Detailed steps",
"Migration 2FA QR code",
"A migration QR code is what you can export, and contains all of your already imported codes.",
"Example: (Google Authenticator).",
"Starts with: (otpauth-migration://).",
"A Google Authenticator code is what you can export, and contains all of your already imported codes.",
"Example: Google Authenticator.",
"Detailed steps",
"Import codes",
"You can import your 2FA codes many way. Choose the most convenient way for you.",
Expand Down
10 changes: 4 additions & 6 deletions languages/hu.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,11 @@ module.exports = {
"Példák",
"TOTP 2FA QR-kód",
"TOTP QR-kód a leggyakoribb fajta 2FA kód, nagyjábol mindenhol ezzel találkozhatsz.",
"Például: (Google, Facebook, Microsoft).",
"Ezzel kezdődik: (otpauth://totp/).",
"Például: Google, Facebook, Microsoft, stb.",
"Részletes leírás",
"Migration 2FA QR-kód",
"A migration QR-kód amit exportálni tudsz és tartalmazza az összes 2FA kódodat.",
"Például: (Google Authenticator).",
"Ezzel kezdődik: (otpauth-migration://).",
"Google Authenticator 2FA QR-kód",
"A Google Authenticator QR-kód amit exportálni tudsz és tartalmazza az összes 2FA kódodat.",
"Például: Google Authenticator.",
"Részletes leírás",
"Kódok importálása",
"Sokféleképpen tudod importálni a 2FA kódjaidat. Válaszd ki a számodra legkényelmesebb módot.",
Expand Down
14 changes: 8 additions & 6 deletions lib/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ module.exports = {
const res = electron.ipcRenderer.sendSync("languageCode").language
let loc_id = 0

document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("[data-loc]").forEach(translateElements)
})
if (res != "en") {
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("[data-loc]").forEach(translateElements)
})

const translateElements = (element) => {
element.textContent = languages[res][renderer][loc_id]
const translateElements = (element) => {
element.textContent = languages[res][renderer][loc_id]

loc_id++
loc_id++
}
}
},

Expand Down

0 comments on commit d3fbc0f

Please sign in to comment.