Skip to content

Commit

Permalink
italian translation
Browse files Browse the repository at this point in the history
  • Loading branch information
xTalAlex committed May 15, 2023
1 parent 928a215 commit 6b432ef
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ module API. Options include:
container: '#some-query-selector'; // container to attach to
APIUrl: 'https://www.example.com/.netlify/functions/identity'; // Absolute url to endpoint. ONLY USE IN SPECIAL CASES!
namePlaceholder: 'some-placeholder-for-Name'; // custom placeholder for name input form
locale: 'en'; // language code for translations - available: en, fr, es, pt, hu, pl, cs, sk - default to en
locale: 'en'; // language code for translations - available: en, fr, es, pt, hu, pl, cs, sk, it - default to en
```
Generally avoid setting the `APIUrl`. You should only set this when your app is
Expand Down
1 change: 1 addition & 0 deletions src/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
<option value="pt">Portugu&ecirc;s</option>
<option value="cs">Česky</option>
<option value="sk">Slovensky</option>
<option value="it">Italiano</option>
</select>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/translations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import * as pt from "./pt.json";
import * as pl from "./pl.json";
import * as cs from "./cs.json";
import * as sk from "./sk.json";
import * as it from "./it.json";

export const defaultLocale = "en";
const translations = { en, fr, es, hu, pt, pl, cs, sk };
const translations = { en, fr, es, hu, pt, pl, cs, sk, it };

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 @@ -48,6 +48,11 @@ describe("translations", () => {
expect(getTranslation("log_in", "sk")).toEqual("Prihlásiť sa");
});

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

it("should return key for non existing translation", () => {
const { getTranslation } = require("./");
expect(getTranslation("unknown_key")).toEqual("unknown_key");
Expand All @@ -62,6 +67,7 @@ describe("translations", () => {
jest.mock("./cs.json", () => ({}));
jest.mock("./sk.json", () => ({}));
jest.mock("./pl.json", () => ({}));
jest.mock("./it.json", () => ({}));

const { getTranslation } = require("./");
expect(getTranslation("log_in")).toEqual("Log in");
Expand All @@ -72,5 +78,6 @@ describe("translations", () => {
expect(getTranslation("log_in", "pl")).toEqual("Log in");
expect(getTranslation("log_in", "cs")).toEqual("Log in");
expect(getTranslation("log_in", "sk")).toEqual("Log in");
expect(getTranslation("log_in", "it")).toEqual("Log in");
});
});
42 changes: 42 additions & 0 deletions src/translations/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"log_in": "Login",
"log_out": "Logout",
"logged_in_as": "Connesso come",
"logged_in": "Connesso",
"logging_in": "Connessione",
"logging_out": "Disconnessione",
"sign_up": "Registrati",
"signing_up": "Registrazione",
"forgot_password": "Password dimenticata?",
"recover_password": "Recupera password",
"send_recovery_email": "Invia email di recupero",
"sending_recovery_email": "Invio email di recupero",
"never_mind": "Annulla",
"update_password": "Aggiorna password",
"updating_password": "Aggiornamento password",
"complete_your_signup": "Completa la registrazione",
"site_url_title": "Impostazioni di sviluppo",
"site_url_link_text": "Elimina l'URL localhost",
"site_url_message": "Esecuzione su server locale rilevata. Inserisci l'URL del tuo sito Netlify.",
"site_url_label": "Inserisci l'URL del tuo sito Netlify",
"site_url_placeholder": "URL del tuo sito Netlify",
"site_url_submit": "Imposta URL",
"message_confirm": "Un messaggio di conferma è stato inviato alla tua email, clicca sul link al suo interno per continuare.",
"message_password_mail": "Abbiamo inviato un email di recupero al tuo account, clicca sul link al suo interno per reimpostare la password.",
"message_email_changed": "Indirizzo email aggiornato!",
"message_verfication_error": "Errore durante la verifica del tuo account. Riprova più tardi o contatta un amministratore.",
"message_signup_disabled": "La registrazione pubblica è disabilitata. Contatta un amministratore per chiedere un invito.",
"form_name_placeholder": "Nome",
"form_email_label": "Inserisci la tua email",
"form_name_label": "Inserisci il tuo nome",
"form_email_placeholder": "Email",
"form_password_label": "Inserisci password",
"form_password_placeholder": "Password",
"coded_by": "Coded by Netlify",
"continue_with": "Continua con",
"No user found with this email": "Nessun utente trovato per questa email",
"Invalid Password": "Password non valida",
"Email not confirmed": "Email non confermata",
"User not found": "Utente non trovato"
}

0 comments on commit 6b432ef

Please sign in to comment.