Skip to content

Commit bd43a02

Browse files
committed
Merge remote-tracking branch 'refs/remotes/template/forks/polyipseity'
# Conflicts: # README.md
2 parents 0e91533 + 2a3b1ea commit bd43a02

File tree

2 files changed

+58
-44
lines changed

2 files changed

+58
-44
lines changed

README.md

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
[changelog]: https://github.com/polyipseity/obsidian-modules/blob/main/CHANGELOG.md
66
[community plugin]: https://obsidian.md/plugins?id=modules
77
[latest release]: https://github.com/polyipseity/obsidian-modules/releases/latest
8-
[other things]: https://github.com/polyipseity/obsidian-monorepo
9-
[plugin library]: https://github.com/polyipseity/obsidian-plugin-library
108
[repository]: https://github.com/polyipseity/obsidian-modules
119
[trailer]: https://raw.githubusercontent.com/polyipseity/obsidian-modules/main/assets/trailer.png
10+
[related]: https://github.com/polyipseity/obsidian-monorepo
1211

1312
Load JavaScript and related languages like TypeScript modules from the vault and the Internet.
1413

1514
[![Buy Me a Coffee/embed]][Buy Me a Coffee]
1615

17-
__[Repository] · [Changelog] · [Community plugin] · [Other things] · [Features](#features) · [Installation](#installation) · [Usage](#usage) · [Contributing](#contributing) · [Security](#security)__
16+
__[Repository] · [Changelog] · [Community plugin] · [Related] · [Features](#features) · [Installation](#installation) · [Usage](#usage) · [Contributing](#contributing) · [Security](#security)__
1817

1918
![Trailer]
2019

@@ -175,47 +174,7 @@ The todos here, ordered alphabetically, are things planned for the plugin. There
175174

176175
### Translating
177176

178-
Translation files are under [`assets/locales/`](assets/locales/). Each locale has its own directory named with its corresponding __[IETF language tag](https://wikipedia.org/wiki/IETF_language_tag)__. Some translation keys are missing here and instead located at [`obsidian-plugin-library`][plugin library].
179-
180-
To contribute translation for an existing locale, modify the files in the corresponding directory.
181-
182-
For a new locale, create a new directory named with its language tag and copy [`assets/locales/en/translation.json`](assets/locales/en/translation.json) into it. Then, add an entry to [`assets/locales/en/language.json`](assets/locales/en/language.json) in this format:
183-
184-
```JSONc
185-
{
186-
// ...
187-
"en": "English",
188-
"(your-language-tag)": "(Native name of your language)",
189-
"uwu": "Uwuish",
190-
// ...
191-
}
192-
```
193-
194-
Sort the list of languages by the alphabetical order of their language tags. Then modify the files in the new directory. There will be errors in [`assets/locales.ts`](assets/locales.ts), which you can ignore and we will fix them for you. You are welcome to fix them yourself if you know TypeScript.
195-
196-
When translating, keep in mind the following things:
197-
198-
- Do not translate anything between `{{` and `}}` (`{{example}}`). They are __interpolations__ and will be replaced by localized strings at runtime.
199-
- Do not translate anything between `$t(` and `)` (`$t(example)`). They refer to other localized strings. To find the localized string being referred to, follow the path of the key, which is separated by dots (`.`). For example, the key [`youtu.be./dQw4w9WgXcQ`](https://youtu.be./dQw4w9WgXcQ) refers to:
200-
201-
```JSONc
202-
{
203-
// ...
204-
"youtu": {
205-
// ...
206-
"be": {
207-
// ...
208-
"/dQw4w9WgXcQ": "I am 'youtu.be./dQw4w9WgXcQ'!",
209-
// ...
210-
},
211-
// ...
212-
},
213-
// ...
214-
}
215-
```
216-
217-
- The keys under `generic` are vocabularies. They can be referred in translation strings by `$t(generic.key)`. Refer to them as much as possible to standardize translations for vocabularies that appear in different places.
218-
- It is okay to move interpolations and references to other localized strings around to make the translation natural. It is also okay to not use some references used in the original translation. However, it is NOT okay to not use all interpolations.
177+
See [`assets/locales/README.md`](assets/locales/README.md).
219178

220179
## Security
221180

assets/locales/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Translating
2+
3+
## Files
4+
5+
Translation files for this project are under this folder.
6+
7+
External translation files:
8+
9+
- [`polyipseity/obsidian-plugin-library`](https://github.com/polyipseity/obsidian-plugin-library/tree/main/assets/locales)
10+
11+
To translate all strings, you also need to translate the external translation files.
12+
13+
## Instructions
14+
15+
Each locale has its own directory named with its corresponding __[IETF language tag](https://wikipedia.org/wiki/IETF_language_tag)__.
16+
17+
To contribute translation for an existing locale, modify the files in the corresponding directory.
18+
19+
For a new locale, create a new directory named with its language tag and copy [`assets/locales/en/translation.json`](assets/locales/en/translation.json) into it. Then, add an entry to [`assets/locales/en/language.json`](assets/locales/en/language.json) in this format:
20+
21+
```JSONc
22+
{
23+
// ...
24+
"en": "English",
25+
"(your-language-tag)": "(Native name of your language)",
26+
"uwu": "Uwuish",
27+
// ...
28+
}
29+
```
30+
31+
Sort the list of languages by the alphabetical order of their language tags. Then modify the files in the new directory. There will be errors in [`assets/locales.ts`](assets/locales.ts), which you can ignore and we will fix them for you. You are welcome to fix them yourself if you know TypeScript.
32+
33+
When translating, keep in mind the following things:
34+
35+
- Do not translate anything between `{{` and `}}` (`{{example}}`). They are __interpolations__ and will be replaced by localized strings at runtime.
36+
- Do not translate anything between `$t(` and `)` (`$t(example)`). They refer to other localized strings. To find the localized string being referred to, follow the path of the key, which is separated by dots (`.`). For example, the key [`youtu.be./dQw4w9WgXcQ`](https://youtu.be./dQw4w9WgXcQ) refers to:
37+
38+
```JSONc
39+
{
40+
// ...
41+
"youtu": {
42+
// ...
43+
"be": {
44+
// ...
45+
"/dQw4w9WgXcQ": "I am 'youtu.be./dQw4w9WgXcQ'!",
46+
// ...
47+
},
48+
// ...
49+
},
50+
// ...
51+
}
52+
```
53+
54+
- The keys under `generic` are vocabularies. They can be referred in translation strings by `$t(generic.key)`. Refer to them as much as possible to standardize translations for vocabularies that appear in different places.
55+
- It is okay to move interpolations and references to other localized strings around to make the translation natural. It is also okay to not use some references used in the original translation. However, it is NOT okay to not use all interpolations.

0 commit comments

Comments
 (0)