Skip to content

Commit

Permalink
hungarian translation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzorz committed Jul 28, 2020
1 parent 377eeef commit ebcf2c9
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
<select name="locale" id="locale" onChange="changeLocale(this.value)">
<option value="en">English</option>
<option value="fr">French</option>
<option value="hu">Magyar</option>
</select>
</div>
</div>
Expand Down
39 changes: 39 additions & 0 deletions src/translations/hu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"log_in": "Bejelentkezés",
"log_out": "Kijelentkezés",
"logged_in_as": "Bejelentkezve mint",
"logged_in": "Bejelentkezve",
"logging_in": "Bejelentkezés...",
"logging_out": "Kijelentkezés...",
"sign_up": "Regisztráció",
"signing_up": "Regisztrálás...",
"forgot_password": "Elfelejtette a jelszavát?",
"recover_password": "Jelszó visszaállítása",
"send_recovery_email": "Jelszópótló levél küldése",
"sending_recovery_email": "Jelszópótló levél küldése...",
"never_mind": "Mégsem",
"update_password": "Új jelszó beállítása",
"updating_password": "Új jelszó beállítása...",
"complete_your_signup": "Regisztráció befejezése",
"site_url_title": "Fejlesztői Beállítások",
"site_url_link_text": "Localhost URL törlése",
"site_url_message": "Úgy néz ki egy helyi szervert futtat. Kérjük adja meg a Netlify oldala URL-jét.",
"site_url_label": "Adja meg a Netlify oldala URL-jét",
"site_url_placeholder": "a Netlify oldala URL-je",
"site_url_submit": "URL beállítása",
"message_confirm": "Elküldtünk egy megerősítő levelet e-mailben, kérjük kattintson a linkre a levélben a folytatáshoz.",
"message_password_mail": "Elküldtünk egy jelszópótló levelet e-mailtben, kérjük kövesse a linket a levélben a jelszava visszaállításához.",
"message_email_changed": "Az e-mail címét frissítettük!",
"message_verfication_error": "probléma történt a fiókja megerősítése közben. Kérjük próbálja újra, vagy vegye fel a kapcsolatot egy adminisztrátorral.",
"message_signup_disabled": "A nyilvános regisztráció nincs engedélyezve. Vegye fel a kapcsolatot egy adminisztrátorral és kérjen meghívót.",
"form_name_placeholder": "Név",
"form_email_label": "Adja meg az e-mail címét",
"form_name_label": "Adja meg a nevét",
"form_email_placeholder": "E-mail",
"form_password_label": "Adja meg a jelszavát",
"form_password_placeholder": "Jelszó",
"coded_by": "Fejlesztette a Netlify",
"No user found with this email": "Nem található fiók ezzel az e-mail címmel",
"Invalid Password": "Helytelen Jelszó",
"continue_with": "Bejelentkezés a következővel:"
}
3 changes: 2 additions & 1 deletion src/translations/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as en from "./en.json";
import * as fr from "./fr.json";
import * as hu from "./hu.json";

export const defaultLocale = "en";
const translations = { en, fr };
const translations = { en, fr, hu };

export const getTranslation = (key, locale = defaultLocale) => {
const translated = translations[locale] && translations[locale][key];
Expand Down
7 changes: 7 additions & 0 deletions src/translations/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ describe("translations", () => {
expect(getTranslation("log_in", "fr")).toEqual("Connexion");
});

it("should return translation for 'hu' locale", () => {
const { getTranslation } = require("./");
expect(getTranslation("log_in", "hu")).toEqual("Bejelentkezés");
});

it("should return key for non existing translation", () => {
const { getTranslation } = require("./");
expect(getTranslation("unknown_key")).toEqual("unknown_key");
Expand All @@ -26,9 +31,11 @@ describe("translations", () => {
it("should default to 'en' on missing key", () => {
jest.mock("./en.json", () => ({ log_in: "Log in" }));
jest.mock("./fr.json", () => ({}));
jest.mock("./hu.json", () => ({}));

const { getTranslation } = require("./");
expect(getTranslation("log_in")).toEqual("Log in");
expect(getTranslation("log_in", "fr")).toEqual("Log in");
expect(getTranslation("log_in", "hu")).toEqual("Bejelentkezés");
});
});

0 comments on commit ebcf2c9

Please sign in to comment.