-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from alexanderwe/feature/addInternalization
Feature/add internalization
- Loading branch information
Showing
19 changed files
with
228 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# Webpack | ||
app/renderer/build | ||
app/main/build | ||
app/build | ||
|
||
# Logs | ||
logs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"about": "Über", | ||
"check": "Check", | ||
"check for updates": "Auf Updates überprüfen...", | ||
"checksum match": "Übereinstimmung", | ||
"checksum mismatch": "Die Checksums stimmen nicht überein", | ||
"checksum fail": "Fehler - Hast du versucht einen Ordner hinzuzufügen?", | ||
"choose file": "Datei wählen...", | ||
"copy": "Kopieren", | ||
"cut": "Ausschneiden", | ||
"drop file": "Datei hier ablegen", | ||
"edit": "Bearbeiten", | ||
"help": "Hilfe", | ||
"hide others": "Andere ausblenden", | ||
"hide": "Verstecken", | ||
"learn more": "Erfahre mehr", | ||
"open logs": "Öffne Logs", | ||
"paste": "Einfügen", | ||
"quit": "Beenden", | ||
"unhide": "Alles anzeigen", | ||
"update available": "Update verfügbar", | ||
"update error": "Fehler beim Suchen nach Updates", | ||
"update latest": "Deine Version ist aktuell" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"about": "Über", | ||
"check": "Check", | ||
"check for updates": "Auf Updates überprüfen...", | ||
"checksum match": "Übereinstimmung", | ||
"checksum mismatch": "Die Checksums stimmen nicht überein", | ||
"checksum fail": "Fehler - Hast du versucht einen Ordner hinzuzufügen?", | ||
"choose file": "Datei wählen...", | ||
"copy": "Kopieren", | ||
"cut": "Ausschneiden", | ||
"drop file": "Datei hier ablegen", | ||
"edit": "Bearbeiten", | ||
"help": "Hilfe", | ||
"hide others": "Andere ausblenden", | ||
"hide": "Verstecken", | ||
"learn more": "Erfahre mehr", | ||
"open logs": "Öffne Logs", | ||
"paste": "Einfügen", | ||
"quit": "Beenden", | ||
"unhide": "Alles anzeigen", | ||
"update available": "Update verfügbar", | ||
"update error": "Fehler beim Suchen nach Updates", | ||
"update latest": "Deine Version ist aktuell" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"about": "Über", | ||
"check": "Check", | ||
"check for updates": "Auf Updates überprüfen...", | ||
"checksum match": "Übereinstimmung", | ||
"checksum mismatch": "Die Checksums stimmen nicht überein", | ||
"checksum fail": "Fehler - Hast du versucht einen Ordner hinzuzufügen?", | ||
"choose file": "Datei wählen...", | ||
"copy": "Kopieren", | ||
"cut": "Ausschneiden", | ||
"drop file": "Datei hier ablegen", | ||
"edit": "Bearbeiten", | ||
"help": "Hilfe", | ||
"hide others": "Andere ausblenden", | ||
"hide": "Verstecken", | ||
"learn more": "Erfahre mehr", | ||
"open logs": "Öffne Logs", | ||
"paste": "Einfügen", | ||
"quit": "Beenden", | ||
"unhide": "Alles anzeigen", | ||
"update available": "Update verfügbar", | ||
"update error": "Fehler beim Suchen nach Updates", | ||
"update latest": "Deine Version ist aktuell" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"about": "Über", | ||
"check": "Check", | ||
"check for updates": "Auf Updates überprüfen...", | ||
"checksum match": "Übereinstimmung", | ||
"checksum mismatch": "Die Checksums stimmen nicht überein", | ||
"checksum fail": "Fehler - Hast du versucht einen Ordner hinzuzufügen?", | ||
"choose file": "Datei wählen...", | ||
"copy": "Kopieren", | ||
"cut": "Ausschneiden", | ||
"drop file": "Datei hier ablegen", | ||
"edit": "Bearbeiten", | ||
"help": "Hilfe", | ||
"hide others": "Andere ausblenden", | ||
"hide": "Verstecken", | ||
"learn more": "Erfahre mehr", | ||
"open logs": "Öffne Logs", | ||
"paste": "Einfügen", | ||
"quit": "Beenden", | ||
"unhide": "Alles anzeigen", | ||
"update available": "Update verfügbar", | ||
"update error": "Fehler beim Suchen nach Updates", | ||
"update latest": "Deine Version ist aktuell" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"about": "About", | ||
"check": "Check", | ||
"check for updates": "Check for updates...", | ||
"checksum match": "Checksum match", | ||
"checksum mismatch": "Checksum mismatch", | ||
"checksum fail": "Error - Did you try to add a directory ?", | ||
"choose file": "Choose file", | ||
"copy": "Copy", | ||
"cut": "Cut", | ||
"drop file": "Drop your file here", | ||
"edit": "Edit", | ||
"help": "Help", | ||
"hide others": "Hide others", | ||
"hide": "Hide", | ||
"learn more": "Learn more", | ||
"open logs": "Open Logs", | ||
"paste": "Paste", | ||
"quit": "Quit", | ||
"unhide": "Unhide", | ||
"update available": "Update available", | ||
"update error": "Error while checking updates", | ||
"update latest": "You have the latest version" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as electron from 'electron'; | ||
import log from 'electron-log'; | ||
import * as fs from 'fs'; | ||
import * as isRenderer from 'is-electron-renderer'; | ||
import * as path from 'path'; | ||
interface ILanguages { | ||
[key: string]: string; | ||
} | ||
|
||
class I18n { | ||
|
||
private loadedLanguage: ILanguages; | ||
private app = electron.app ? electron.app : electron.remote.app; | ||
|
||
constructor() { | ||
if (isRenderer) { | ||
// we are invoking the i18n from the renderer and need another path | ||
if (fs.existsSync(path.join(__dirname, '../build/' + this.app.getLocale() + '.json'))) { | ||
this.loadedLanguage = JSON.parse(fs.readFileSync(path.join(__dirname, '../build/' + this.app.getLocale() + '.json'), 'utf8')); | ||
} else { | ||
this.loadedLanguage = JSON.parse(fs.readFileSync(path.join(__dirname, '../build/' + 'en.json'), 'utf8')); | ||
} | ||
} else { | ||
if (fs.existsSync(path.join(__dirname, '/' + this.app.getLocale() + '.json'))) { | ||
this.loadedLanguage = JSON.parse(fs.readFileSync(path.join(__dirname, '/' + this.app.getLocale() + '.json'), 'utf8')); | ||
} else { | ||
this.loadedLanguage = JSON.parse(fs.readFileSync(path.join(__dirname, 'en.json'), 'utf8')); | ||
} | ||
} | ||
|
||
} | ||
|
||
public translate(phrase: string): string { | ||
let translation = this.loadedLanguage[phrase]; | ||
if (translation === undefined) { | ||
translation = phrase; | ||
} | ||
return translation; | ||
} | ||
} | ||
|
||
export default I18n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.