-
Notifications
You must be signed in to change notification settings - Fork 737
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Release v0.0.1-alpha.12 (#439)
- Loading branch information
Showing
179 changed files
with
10,108 additions
and
7,256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: 🌐 Internationalization (i18n) | ||
description: Contribute to or report issues with translations | ||
title: "[i18n]: " | ||
labels: ["i18n", "triage"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to contribute to our internationalization efforts! | ||
Before proceeding, please check our [i18n Contribution Guidelines](https://github.com/RSSNext/Follow/blob/dev/wiki/contribute-i18n.md) for detailed instructions. | ||
- type: dropdown | ||
id: type | ||
attributes: | ||
label: Type of i18n contribution | ||
options: | ||
- New language support | ||
- Update existing translations | ||
- Report incorrect translation | ||
- Other i18n-related issue | ||
validations: | ||
required: true | ||
- type: input | ||
id: language | ||
attributes: | ||
label: Language | ||
description: What language are you contributing to or reporting about? | ||
placeholder: e.g., Spanish, French, Japanese | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: description | ||
attributes: | ||
label: Description | ||
description: Please provide details about your contribution or the issue you're reporting. | ||
placeholder: | | ||
For new languages: List any specific challenges or considerations. | ||
For updates: Describe what you're changing and why. | ||
For issues: Provide the incorrect translation and suggest a correction. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: additional-context | ||
attributes: | ||
label: Additional context | ||
description: Add any other context, screenshots, or file references here. | ||
- type: checkboxes | ||
id: terms | ||
attributes: | ||
label: Code of Conduct | ||
description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com/code-of-conduct) | ||
options: | ||
- label: I agree to follow this project's Code of Conduct | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import fs from "node:fs" | ||
import path from "node:path" | ||
|
||
type LanguageCompletion = Record<string, number> | ||
|
||
function getLanguageFiles(dir: string): string[] { | ||
return fs.readdirSync(dir).filter((file) => file.endsWith(".json")) | ||
} | ||
|
||
function getNamespaces(localesDir: string): string[] { | ||
return fs | ||
.readdirSync(localesDir) | ||
.filter((file) => fs.statSync(path.join(localesDir, file)).isDirectory()) | ||
} | ||
|
||
function countKeys(obj: any): number { | ||
let count = 0 | ||
for (const key in obj) { | ||
if (typeof obj[key] === "object") { | ||
count += countKeys(obj[key]) | ||
} else { | ||
count++ | ||
} | ||
} | ||
return count | ||
} | ||
|
||
function calculateCompleteness(localesDir: string): LanguageCompletion { | ||
const namespaces = getNamespaces(localesDir) | ||
const languages = new Set<string>() | ||
const keyCount: Record<string, number> = {} | ||
|
||
namespaces.forEach((namespace) => { | ||
const namespaceDir = path.join(localesDir, namespace) | ||
const files = getLanguageFiles(namespaceDir) | ||
|
||
files.forEach((file) => { | ||
const lang = path.basename(file, ".json") | ||
languages.add(lang) | ||
|
||
const content = JSON.parse(fs.readFileSync(path.join(namespaceDir, file), "utf-8")) | ||
keyCount[lang] = (keyCount[lang] || 0) + countKeys(content) | ||
}) | ||
}) | ||
|
||
const enCount = keyCount["en"] || 0 | ||
const completeness: LanguageCompletion = {} | ||
|
||
languages.forEach((lang) => { | ||
if (lang !== "en") { | ||
const percent = Math.round((keyCount[lang] / enCount) * 100) | ||
completeness[lang] = percent | ||
} | ||
}) | ||
|
||
return completeness | ||
} | ||
|
||
const i18n = calculateCompleteness(path.resolve(__dirname, "../locales")) | ||
export default i18n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.