Skip to content

Commit 2dc4cad

Browse files
Bugadinhosewnie
authored andcommitted
Add translation documentation
1 parent af08bc7 commit 2dc4cad

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

src/SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
- [Vinegar Tips and tricks](./Vinegar/TipsAndTricks.md)
1010
- [Vinegar Troubleshooting](./Vinegar/Troubleshooting.md)
1111
- [Vinegar FAQ](./Vinegar/FAQ.md)
12-
- [Contributing](./Vinegar/Contributing.md)
12+
- [Contributing](./Vinegar/Contributing/index.md)
13+
- [Translating Vinegar](./Vinegar/Contributing/guides/translation.md)
1314

1415
# Sober
1516
- [Sober Installation](./Sober/Installation.md)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Translating Vinegar
2+
3+
## Prerequisites
4+
5+
To translate Vinegar, one must already have an environment setup capable of compiling Vinegar as detailed in [Installing from source](../../Installation/guides/source.md).
6+
7+
## Translating a new language
8+
9+
### Generating base POT file
10+
11+
In order to translate Vinegar, you must first generate a template file with all of Vinegar's strings dumped onto it with the following commands (inside the source directory):
12+
13+
```console
14+
find . -name '*.go' | xargs xgettext --language=Go --keyword=_ --keyword=i18n.Local --keyword=Local --keyword=i18n.LocalDomain:2 --keyword=LocalDomain:2 --omit-header -o default.pot
15+
find . -name '*.ui' | xargs xgettext --language=Glade --omit-header --join-existing -o default.pot
16+
```
17+
18+
This will generate most of the strings necessary for translation in a file called `default.pot`, however due to how Vinegar's settings are internally structured, some strings will need to manually be included, these strings are located in [config.go](https://github.com/vinegarhq/vinegar/blob/master/internal/config/config.go) in the `Studio` and `Config` structs, you will need to manually create `msgid` and `msgstr` field for them like so:
19+
20+
```pot
21+
msgid "Studio's Graphics Mode"
22+
msgstr ""
23+
```
24+
25+
### Defining the language
26+
27+
Move the `default.pot` file inside the `data\po` directory and rename it to `{LOCALE}.po`, replacing `{LOCALE}` with the system locale for your desired language, after that all that remains is to manually translate every `msgid`'s respective `msgstr` field with your translation.
28+
29+
## Updating an existing translation
30+
31+
Translations are located in the `data\po` directory, updating an existing translation is as simple as editing your desired language's .po file in any text editor. The `msgid` field is the original string inside Vinegar's source code and the `msgstr` field is the translated version.
32+
33+
## Testing
34+
35+
To test a translation, you must build Vinegar with the changes you made as detailed in [Installing from source](../../Installation/guides/source.md), set the system language to your desired language and launch Vinegar.
36+
37+
## Contributing
38+
39+
After your translation is complete, open a pull request in Vinegar's repository with your new `.po` file, preferably detailing what you did on the translation, and continue on from there.
File renamed without changes.

0 commit comments

Comments
 (0)