Skip to content

Commit 1fbb00c

Browse files
dsoaressheyamie
andauthored
feat: Portuguese translation (#352)
Co-authored-by: amarilis <[email protected]>
1 parent 01395a0 commit 1fbb00c

File tree

5 files changed

+52
-2
lines changed

5 files changed

+52
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ module API. Options include:
154154
container: '#some-query-selector'; // container to attach to
155155
APIUrl: 'https://www.example.com/.netlify/functions/identity'; // Absolute url to endpoint. ONLY USE IN SPECIAL CASES!
156156
namePlaceholder: 'some-placeholder-for-Name'; // custom placeholder for name input form
157-
locale: 'en'; // language code for translations - available: en, fr, es - default to en
157+
locale: 'en'; // language code for translations - available: en, fr, es, pt, hu - default to en
158158
}
159159
```
160160

src/index.ejs

+1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@
310310
<option value="fr">Fran&ccedil;ais</option>
311311
<option value="es">Espa&ntilde;ol</option>
312312
<option value="hu">Magyar</option>
313+
<option value="pt">Portugu&ecirc;s</option>
313314
</select>
314315
</div>
315316
</div>

src/translations/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import * as en from "./en.json";
22
import * as fr from "./fr.json";
33
import * as es from "./es.json";
44
import * as hu from "./hu.json";
5+
import * as pt from "./pt.json";
56

67
export const defaultLocale = "en";
7-
const translations = { en, fr, es, hu };
8+
const translations = { en, fr, es, hu, pt };
89

910
export const getTranslation = (key, locale = defaultLocale) => {
1011
const translated = translations[locale] && translations[locale][key];

src/translations/index.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ describe("translations", () => {
2828
expect(getTranslation("log_in", "es")).toEqual("Iniciar sesión");
2929
});
3030

31+
it("should return translation for 'pt' locale", () => {
32+
const { getTranslation } = require("./");
33+
expect(getTranslation("log_in", "pt")).toEqual("Entrar");
34+
});
35+
3136
it("should return key for non existing translation", () => {
3237
const { getTranslation } = require("./");
3338
expect(getTranslation("unknown_key")).toEqual("unknown_key");
@@ -38,11 +43,13 @@ describe("translations", () => {
3843
jest.mock("./fr.json", () => ({}));
3944
jest.mock("./hu.json", () => ({}));
4045
jest.mock("./es.json", () => ({}));
46+
jest.mock("./pt.json", () => ({}));
4147

4248
const { getTranslation } = require("./");
4349
expect(getTranslation("log_in")).toEqual("Log in");
4450
expect(getTranslation("log_in", "fr")).toEqual("Log in");
4551
expect(getTranslation("log_in", "hu")).toEqual("Log in");
4652
expect(getTranslation("log_in", "es")).toEqual("Log in");
53+
expect(getTranslation("log_in", "pt")).toEqual("Log in");
4754
});
4855
});

src/translations/pt.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"log_in": "Entrar",
3+
"log_out": "Sair",
4+
"logged_in_as": "Logado como",
5+
"logged_in": "Logado em",
6+
"logging_in": "Logando em",
7+
"logging_out": "Saindo",
8+
"sign_up": "Registrar",
9+
"signing_up": "Registrando",
10+
"forgot_password": "Esqueceu a senha?",
11+
"recover_password": "Recuperar senha",
12+
"send_recovery_email": "Enviar email de recuperação de senha",
13+
"sending_recovery_email": "Enviando email de recuperação de senha",
14+
"never_mind": "Deixa pra lá",
15+
"update_password": "Atualizar senha",
16+
"updating_password": "Atualizando senha",
17+
"complete_your_signup": "Complete seu registro",
18+
"site_url_title": "Configurações de desenvolvimento",
19+
"site_url_link_text": "Limpar URL do localhost",
20+
"site_url_message": "Parece que você está executando um servidor local. Informe-nos o URL do seu site Netlify.",
21+
"site_url_label": "Insira o URL do seu site Netlify",
22+
"site_url_placeholder": "URL do seu site Netlify",
23+
"site_url_submit": "Configure a URL do seu site",
24+
"message_confirm": "Uma mensagem de confirmação foi enviada para o seu email, clique no link para continuar.",
25+
"message_password_mail": "Enviamos um e-mail de recuperação para sua conta, siga o link para redefinir sua senha.",
26+
"message_email_changed": "Seu email foi atualizado!",
27+
"message_verfication_error": "Ocorreu um erro ao verificar sua conta. Tente novamente ou entre em contato com um administrador.",
28+
"message_signup_disabled": "Registros públicos estão desabilitados. Contate um administrador e peça por um convite.",
29+
"form_name_placeholder": "Nome",
30+
"form_email_label": "Insira seu email",
31+
"form_name_label": "Insira seu nome",
32+
"form_email_placeholder": "Email",
33+
"form_password_label": "Insira sua senha",
34+
"form_password_placeholder": "Senha",
35+
"coded_by": "Desenvolvido por Netlify",
36+
"continue_with": "Continue com",
37+
"No user found with this email": "Nenhum usuário encontrado com esse email",
38+
"Invalid Password": "Senha inválida",
39+
"Email not confirmed": "Email não confirmado",
40+
"User not found": "Usuário não encontrado"
41+
}

0 commit comments

Comments
 (0)