From 6f4805dda174b3352185cf4c6200b661557e7ad5 Mon Sep 17 00:00:00 2001 From: Rangga Fajar Oktariansyah <86386385+FajarKim@users.noreply.github.com> Date: Sat, 26 Oct 2024 06:07:04 +0700 Subject: [PATCH 1/4] chore: move translations file and this documentation to `i18n` folder --- docs/translations.md => i18n/README.md | 0 src/translations.ts => i18n/index.ts | 0 scripts/generate-translation-doc.ts | 2 +- src/card.ts | 2 +- tests/card.test.ts | 2 +- tests/renderStatsCard.test.ts | 2 +- 6 files changed, 4 insertions(+), 4 deletions(-) rename docs/translations.md => i18n/README.md (100%) rename src/translations.ts => i18n/index.ts (100%) diff --git a/docs/translations.md b/i18n/README.md similarity index 100% rename from docs/translations.md rename to i18n/README.md diff --git a/src/translations.ts b/i18n/index.ts similarity index 100% rename from src/translations.ts rename to i18n/index.ts diff --git a/scripts/generate-translation-doc.ts b/scripts/generate-translation-doc.ts index fdce7e5..c02993d 100644 --- a/scripts/generate-translation-doc.ts +++ b/scripts/generate-translation-doc.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import locales from "../src/translations"; +import locales from "../i18n/index"; import languageNames from "./languageNames"; const TARGET_FILE = "./docs/translations.md"; diff --git a/src/card.ts b/src/card.ts index b6cf5f5..c3c7b6b 100644 --- a/src/card.ts +++ b/src/card.ts @@ -2,7 +2,7 @@ import sharp from "sharp"; import parseBoolean from "@barudakrosul/parse-boolean"; import type { GetData } from "./getData"; import type { UiConfig } from "../api/index"; -import { locales, Locales } from "./translations"; +import { locales, Locales } from "../i18n/index"; import icons from "./icons"; /** diff --git a/tests/card.test.ts b/tests/card.test.ts index f9aa94e..9525145 100644 --- a/tests/card.test.ts +++ b/tests/card.test.ts @@ -1,5 +1,5 @@ import card from "../src/card"; -import locales from "../src/translations"; +import locales from "../i18n/index"; describe("Test card function", () => { const mockData = { diff --git a/tests/renderStatsCard.test.ts b/tests/renderStatsCard.test.ts index 0bc225b..e8975a5 100644 --- a/tests/renderStatsCard.test.ts +++ b/tests/renderStatsCard.test.ts @@ -3,7 +3,7 @@ import getData from "../src/getData"; import type { User } from "../src/fetcher/stats"; import card from "../src/card"; import themes from "../themes/index"; -import locales from "../src/translations"; +import locales from "../i18n/index"; jest.mock("../src/getData"); jest.mock("../src/card"); From 34c23fe9848cd853eba679abc1b2ec10fa8570f3 Mon Sep 17 00:00:00 2001 From: Rangga Fajar Oktariansyah <86386385+FajarKim@users.noreply.github.com> Date: Sat, 26 Oct 2024 06:12:08 +0700 Subject: [PATCH 2/4] update some files --- CONTRIBUTING.md | 2 +- README.md | 4 ++-- scripts/generate-translation-doc.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85ad483..f0ac012 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,7 +35,7 @@ To contribute your theme you need to edit the [themes/index.ts](/themes/index.ts ## 🗣️ Translations Contribution GitHub Readme Profile supports multiple languages, if we are missing your language, you can contribute it! You can check the currently supported languages [here](/README.md#available-locales). -To contribute your language you need to edit the [src/translations.ts](/src/translations.ts) file and add new property to each object where the key is the language code in ISO 639-1 standard and the value is the translated string. Anything appearing in [the list](https://gist.github.com/FajarKim/91516c2aecbfc8bf65f584d528d5f2b1) should be fine. +To contribute your language you need to edit the [i18n/index.ts](/i18n/index.ts) file and add new property to each object where the key is the language code in ISO 639-1 standard and the value is the translated string. Anything appearing in [the list](https://gist.github.com/FajarKim/91516c2aecbfc8bf65f584d528d5f2b1) should be fine. ## 📑 Any contributions you make will be under the MIT Software License diff --git a/README.md b/README.md index e969489..2ef760b 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ You can customize the appearance of all your cards however you wish with URL par

locale

-

Sets the language in the card, you can check full list of available locales here.

+

Sets the language in the card, you can check full list of available locales here.

enum

en

@@ -321,7 +321,7 @@ You can pass a query parameter `&show=` to show any specific additional stats wi -See [more](/docs/translations.md) available locale. The locale code added to file should be a 2-letter abbreviation from [ISO 639-1](https://www.andiamo.co.uk/resources/iso-language-codes/) or a 4-letter code with a language and country code (eg. `id` or `pt-BR`). Anything appearing in [the list](https://gist.github.com/FajarKim/91516c2aecbfc8bf65f584d528d5f2b1) should be fine. You can also contribute new translations if you like, contributing guidelines can be found [here](/CONTRIBUTING.md#%EF%B8%8F-translations-contribution). +See [more](/i18n/README.md) available locale. The locale code added to file should be a 2-letter abbreviation from [ISO 639-1](https://www.andiamo.co.uk/resources/iso-language-codes/) or a 4-letter code with a language and country code (eg. `id` or `pt-BR`). Anything appearing in [the list](https://gist.github.com/FajarKim/91516c2aecbfc8bf65f584d528d5f2b1) should be fine. You can also contribute new translations if you like, contributing guidelines can be found [here](/CONTRIBUTING.md#%EF%B8%8F-translations-contribution). ```markdown ![GitHub Stats](https://gh-readme-profile.vercel.app/api?username=FajarKim&locale=id) diff --git a/scripts/generate-translation-doc.ts b/scripts/generate-translation-doc.ts index c02993d..90ecc4a 100644 --- a/scripts/generate-translation-doc.ts +++ b/scripts/generate-translation-doc.ts @@ -2,7 +2,7 @@ import fs from "fs"; import locales from "../i18n/index"; import languageNames from "./languageNames"; -const TARGET_FILE = "./docs/translations.md"; +const TARGET_FILE = "./i18n/README.md"; function generateTranslationsMarkdown(locale: string): string { return `${locale}`; From c945ee8005d19f4e901ab26fbbef4bce5a86dea8 Mon Sep 17 00:00:00 2001 From: Rangga Fajar Oktariansyah <86386385+FajarKim@users.noreply.github.com> Date: Sat, 26 Oct 2024 06:14:48 +0700 Subject: [PATCH 3/4] update test file --- tests/renderDocsReadme.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/renderDocsReadme.test.ts b/tests/renderDocsReadme.test.ts index dcd977c..60be5b2 100644 --- a/tests/renderDocsReadme.test.ts +++ b/tests/renderDocsReadme.test.ts @@ -15,6 +15,6 @@ describe("Test Generate Readme Docs", () => { it("should generate the README content locales correctly", () => { const generatedReadme = generateReadmeLocales(); - expect(fs.writeFileSync).toHaveBeenCalledWith("./docs/translations.md", generatedReadme); + expect(fs.writeFileSync).toHaveBeenCalledWith("./i18n/README.md", generatedReadme); }); }); From a38fd5e8855c566a58579e11f817450279d89a58 Mon Sep 17 00:00:00 2001 From: Rangga Fajar Oktariansyah <86386385+FajarKim@users.noreply.github.com> Date: Sat, 26 Oct 2024 06:17:49 +0700 Subject: [PATCH 4/4] move language name file from scripts folder to i18n folder --- {scripts => i18n}/languageNames.ts | 0 scripts/generate-translation-doc.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename {scripts => i18n}/languageNames.ts (100%) diff --git a/scripts/languageNames.ts b/i18n/languageNames.ts similarity index 100% rename from scripts/languageNames.ts rename to i18n/languageNames.ts diff --git a/scripts/generate-translation-doc.ts b/scripts/generate-translation-doc.ts index 90ecc4a..685752c 100644 --- a/scripts/generate-translation-doc.ts +++ b/scripts/generate-translation-doc.ts @@ -1,6 +1,6 @@ import fs from "fs"; import locales from "../i18n/index"; -import languageNames from "./languageNames"; +import languageNames from "../i18n/languageNames"; const TARGET_FILE = "./i18n/README.md";