Skip to content

Commit 52d1c44

Browse files
author
Kirill Noskov
committed
resolving conflicts with pt
1 parent e112e3f commit 52d1c44

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
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, ru - default to en
157+
locale: 'en'; // language code for translations - available: en, fr, es, pt, hu, ru - default to en
158158
}
159159
```
160160

src/translations/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as hu from "./hu.json";
55
import * as ru from "./ru.json";
66

77
export const defaultLocale = "en";
8-
const translations = { en, fr, es, hu, ru };
8+
const translations = { en, fr, es, hu, pt, ru };
99

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

src/translations/index.test.js

Lines changed: 7 additions & 0 deletions
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 translation for 'ru' locale", () => {
3237
const { getTranslation } = require("./");
3338
expect(getTranslation("log_in", "ru")).toEqual("Войти");
@@ -43,13 +48,15 @@ describe("translations", () => {
4348
jest.mock("./fr.json", () => ({}));
4449
jest.mock("./hu.json", () => ({}));
4550
jest.mock("./es.json", () => ({}));
51+
jest.mock("./pt.json", () => ({}));
4652
jest.mock("./ru.json", () => ({}));
4753

4854
const { getTranslation } = require("./");
4955
expect(getTranslation("log_in")).toEqual("Log in");
5056
expect(getTranslation("log_in", "fr")).toEqual("Log in");
5157
expect(getTranslation("log_in", "hu")).toEqual("Log in");
5258
expect(getTranslation("log_in", "es")).toEqual("Log in");
59+
expect(getTranslation("log_in", "pt")).toEqual("Log in");
5360
expect(getTranslation("log_in", "ru")).toEqual("Log in");
5461
});
5562
});

0 commit comments

Comments
 (0)