11 Commits
Author SHA1 Message Date
L1Z0 d81dd3b4e7 Merge pull request 'merge longcha's latest changes and fix longcha's typos.' (#15) from mystya/NoN-Translations:main into main
Reviewed-on: L1Z0/NoN-Translations#15
2026-09-22 07:19:18 -05:00
mystya 2d79ca30a1 edited typos and wrong line position due https://discord.com/channels/1522184819293814914/1534915146164473856/1551851848179122217 2026-09-22 16:08:03 +08:00
mystya a64fee7321 merge longcha's latest transtation(pulls #14) 2026-09-22 16:06:46 +08:00
L1Z0 a5319c4411 Merge pull request 'nsfw' (#11) from longcha/NoN-Translations:longcha-patch-7 into main
Reviewed-on: L1Z0/NoN-Translations#11
2026-09-21 06:36:00 -05:00
L1Z0 2da54c1f80 Merge pull request 'sfwzh_cn' (#12) from longcha/NoN-Translations:longcha-patch-6 into main
Reviewed-on: L1Z0/NoN-Translations#12
2026-09-21 06:34:48 -05:00
longcha 81b8efb095 更新 SFW (baked in NoN)/zh_cn.json 2026-09-21 00:56:49 -05:00
longcha eb17c4e383 nsfw
**Localized into Chinese.**
2026-09-21 00:17:36 -05:00
longcha 669acbc2c8 sfwzh_cn
**I will change all the parts that don’t fit the SFW format, but I insist that the translation must be localized. This mod is very popular in the Chinese community. At the very least, I can’t let them see incorrect achievement translations.**
2026-09-21 00:08:47 -05:00
L1Z0 37f924ea9e added machine translated keys 2026-09-20 21:45:08 +02:00
L1Z0 4531bb2372 Merge pull request 'Ensure SFW content is completely SFW, remove incorrect translations, fix formatting, and add missing strings.' (#10) from mystya/NoN-Translations:main into main
Reviewed-on: L1Z0/NoN-Translations#10
2026-09-20 14:33:23 -05:00
mystya 2d7932a48e cherrypick 344757c8 (script generate edit by d4113399) 2026-09-19 18:57:52 +08:00
7 changed files with 0 additions and 3207 deletions
-1
View File
@@ -1 +0,0 @@
/node_modules/
-15
View File
@@ -25,18 +25,3 @@ These might look incorrect but with `%s` inserted it will be things like
- `destroyed skin` and `ripped skin` refer to NoN's ripped-clothing appearance. Prefer wording about a damaged appearance, outfit, or clothing when a literal translation would imply bodily injury.
- Keep filenames and paths such as `destroyed_skin.png`, `destroyed_skin_mask_%s.png`, and `config/needsofnature` unchanged.
- Keep mod and project names such as `Quick Skin`, `Skin Overrides`, `CPM`, `Figura`, `NoFigura`, and `NoN` unchanged.
## Translation Utility
make.ts merges multiple language files into one for easy editing, then splits them back into separate files. This tool lets you:
- find the original text without searching another file
- automatically remove duplicate text to save space
- sort your i18n files according to the official order
### Usage
1. Open `make.ts` and edit the `targetLangFiles` and the `workFile` fields, change `zh_cn` to your language. please notice that The `suffix` and `file` values must be unique.
2. Run `./make.ts` (or `ts-node make.ts` / `deno make.ts`). The language files will be merged into the `workFile` location (e.g. `zh_cn.json`).
3. Edit the output file.
4. Run `./make.ts` again. If the workfile is newer than the other files, the script will write the changes back to the language files (at the locations specified by `targetLangFiles`).
5. If you don't want a language to be written back, add `ro: true` to its entry in `targetLangFiles`.
-109
View File
@@ -1,109 +0,0 @@
#!/usr/bin/env ts-node
import fs from 'fs';
// a sample tool that merge (zh|en)(sfw|nsfw) ver together for edit faster
// for other language translator: if you need to use this script, just edit `targetLangFiles` and `workFile`.
const targetLangFiles: LanguageInstance[] = [
{suffix: "en_us_nsfw", file: "NSFW (Default Pack)/en_us.json", overrideSuffix: "en_us_sfw", ro: true},
{suffix: "en_us_sfw", file: "SFW (baked in NoN)/en_us.json", ro: true},
{suffix: "zh_cn_nsfw", file: "NSFW (Default Pack)/zh_cn.json", overrideSuffix: "zh_cn_sfw"},
{suffix: "zh_cn_sfw", file: "SFW (baked in NoN)/zh_cn.json"}
]
const workFile = "zh_cn.json"
type LanguageInstance = {
suffix: string,
file: string,
data?: Record<string, string>,
overrideSuffix?: string,
override?: LanguageInstance,
ro?: boolean // read only, don't edit.
}
const mainLangFile = "SFW (baked in NoN)/en_us.json";
const targetLangFilesBySuffix: Record<string, LanguageInstance> = {}
for (let l of targetLangFiles) {
if (!l.suffix.match(/^[a-z0-9-_]+$/i)) throw new Error(`bad Suffix: ${JSON.stringify(l.suffix)} that not match ^[a-z0-9-_]+$ (ignore case)`)
targetLangFilesBySuffix[l.suffix] = l
}
for (let l of targetLangFiles) {
if (l.overrideSuffix) l.override = targetLangFilesBySuffix[l.overrideSuffix]
}
type KVPair = [string, string];
function parseOrdered(src: string): KVPair[] {
const o: KVPair[] = [];
JSON.parse(src, (k, v) => {
if (k === '') return v
if (typeof k !== "string" || typeof v !== "string") throw new Error(`unexpected k/v:${JSON.stringify([k, v])}`)
o.push([k, v])
return v;
});
return o;
}
function stringify(data: KVPair[]): string {
const s = JSON.stringify
const body = data.map(([k, v]) => ` ${s(k)}: ${s(v)}`).join(",\n")
return `{\n${body}\n}\n`
}
const keyOrder = parseOrdered(fs.readFileSync(mainLangFile, "utf-8")).map(([k, v]) => k)
function genMergedLang(): void {
for (const l of targetLangFiles) {
l.data = JSON.parse(fs.readFileSync(l.file, "utf-8")) as Record<string, string>
}
const output: KVPair[] = []
for (let key of keyOrder) {
for (let l of targetLangFiles) {
let value = l.data?.[key];
if (l.override?.data?.[key] === value) value = undefined
if (value) output.push([`${key}.${l.suffix}`, value])
}
}
fs.writeFileSync(workFile, stringify(output))
}
function writeBackLang() {
let mixed = parseOrdered(fs.readFileSync(workFile, "utf-8"));
const buffer: Record<string, KVPair[]> = {}
for (const key of Object.keys(targetLangFilesBySuffix)) buffer[key] = []
for (const [k, v] of mixed) {
const [key, suffix] = k.split(/\.(?=[^.]*$)/);
if (!buffer[suffix]) throw new Error(`can't parse the suffix: ${JSON.stringify(suffix)} from key: ${JSON.stringify(k)}`)
buffer[suffix].push([key, v])
}
for (let suffix in buffer) {
if (targetLangFilesBySuffix[suffix].ro) continue
fs.writeFileSync(targetLangFilesBySuffix[suffix].file, stringify(buffer[suffix]))
}
}
;(() => {
let files = [targetLangFiles.map(l => l.file), workFile].flat()
let latestFile = files.reduce<{ mtime: Date, fileName: string } | null>(
(latest, file) => {
if (!fs.existsSync(file)) return latest
let stat = fs.statSync(file);
if (!latest) return {mtime: stat.mtime, fileName: file};
return stat.mtime > latest.mtime ? {mtime: stat.mtime, fileName: file} : latest
}, null);
if (!latestFile) return
if (latestFile.fileName === workFile)
writeBackLang()
else
genMergedLang()
})();
-29
View File
@@ -1,29 +0,0 @@
{
"name": "NoN-Translations",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"devDependencies": {
"@types/node": "^26.6.2"
}
},
"node_modules/@types/node": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.2.tgz",
"integrity": "sha512-X1P21scMv4zGKLYqjdGjaKa7COa0RKVYYZZN/NfvLQ1JegxFhdhpZG/Lyn8AXx6CDUavKAd11v6BvfpkDByK8g==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~8.9.0"
}
},
"node_modules/undici-types": {
"version": "8.9.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
"integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
"dev": true,
"license": "MIT"
}
}
}
-5
View File
@@ -1,5 +0,0 @@
{
"devDependencies": {
"@types/node": "^26.6.2"
}
}
-6
View File
@@ -1,6 +0,0 @@
{
"compilerOptions": {
"module": "nodenext",
"types": ["node"]
}
}
-3042
View File
File diff suppressed because it is too large Load Diff