Add Documentation for Codeberg Translate (#300)

This is a simple documentation for Codeberg Translate. I think it can be improved in some points (especially the wording), but it should be a good start.

Closes: https://codeberg.org/Codeberg/Documentation/issues/273
Reviewed-on: https://codeberg.org/Codeberg/Documentation/pulls/300
Co-authored-by: JakobDev <jakobdev@gmx.de>
Co-committed-by: JakobDev <jakobdev@gmx.de>
This commit is contained in:
JakobDev 2023-07-04 21:02:20 +00:00 committed by Otto
parent 065c065e09
commit ff8910c5ee
8 changed files with 118 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View file

@ -0,0 +1,56 @@
---
eleventyNavigation:
key: CodebergTranslateGettingStarted
title: Getting started
parent: CodebergTranslate
---
This article will guide you, how to integrate Weblate with Codeberg.
## Projects and Components
The first thing you might notice, is that Weblate has Projects and Components. A Component is something that can be translated e.g. a Software or a Documentation. A Project is a Collection of Components that belong to the same thing.
e.g. You have a Software and the corresponding Documentation. Both use different translation systems. So you add a Project for your Software and one Component for the Software itself and another one for the Documentation.
In simple cases you only need one Component in a Project.
## Create a new Project
On [Codeberg Translate](https://translate.codeberg.org/) log in with your Codeberg Account. Now click on "+" and select "Add new translation project".
Now just enter some Metadata such as the Name, the URL slug (This is just the URL you find your projects. You project will live under the URL `https://translate.codeberg.org/projects/<your slug>`), the Link to the Website (if you
don't have one, just use the URL of your Codeberg Repo) and some instructions, how this Project should be translated (can be empty). This are just Metadata. They have no meaning, when you connect to your Codeberg Repo later.
Click on "Save" and you are done.
## Add a Component
You now see your new project with no components at all. Now let's add a Component.
1. First click on the "Add new translation component" Button. You should see this Page.
<picture>
<source srcset="/assets/images/codeberg-translate/getting-started/add-component.webp" type="image/webp">
<img src="/assets/images/codeberg-translate/getting-started/add-component.png" alt="Image the add component page">
</picture>
2. Now enter the following:
- Name: The Name of your Component. You can choose freely.
- URL slug: The URL, you can find your Component (`https://translate.codeberg.org/projects/<your project>/<your component slug>`)
- Source language: If the source language of your Project is not English, select it here.
- Source code repository: The URL to your Codeberg Repo e.g. `https://codeberg.org/Codeberg/Documentation`. If you already have a component, that uses this Repo, use `weblate://<project>/<component>` to link it with the existing component instead.
Leave the rest as it is and click "Continue". Weblate will now scan your Repo and you should see something like this:
<picture>
<source srcset="/assets/images/codeberg-translate/getting-started/add-component-choose.webp" type="image/webp">
<img src="/assets/images/codeberg-translate/getting-started/add-component.choose.png" alt="Image the add component page">
</picture>
Weblate have searched your Repo for common translation structures and presents you what was found. If you select one, Weblate will set some settings automatically. You can change them later or fully configure
the component manually. Please note, that one Component only works with one translation system in one directory. If you have multiple, you need to add multiple components.
1. On the following page, you should select "Gitea pull request" under "Version control system", so Weblate will create a new PR to submit changes to your Repo.
If you haven't selected a Configuration from Weblate, visit [Manual Component configuration](/codeberg-translate/manual-component-configuration).
Now you should just select a Translation License and click "Save". Now you are done on the Weblate side.
2. On the Codeberg side, open your Repo settings and go the Webhooks. Now click "Add Webhook" and select "Gitea" from the drop down. Under "Target URL" enter `https://translate.codeberg.org/hooks/gitea` and click
"Add Webhook". Now Codeberg will notify Weblate about changes in your Repo, so it will be automatically updated.
Now you can share to the Link to Weblate to your translators.
## Commit translations to Codeberg
To commit the translations from your Component to Codeberg, go to your Component>Manage>Repository Maintance and click on "Push"

View file

@ -0,0 +1,10 @@
---
eleventyNavigation:
key: CodebergTranslate
title: Codeberg Translate
icon: language
order: 71
description: These articles shows you how to use Codeberg Translate
---
These documentation pages contain information on how you can use [Codeberg Translate](https://translate.codeberg.org)

View file

@ -0,0 +1,19 @@
---
eleventyNavigation:
key: WeblateIntroduction
title: Introduction to Weblate
parent: CodebergTranslate
---
Codeberg hosts it's own [Weblate](https://weblate.org) Instance to help Codeberg users localize their Software. This service is called [Codeberg Translate](https://translate.codeberg.org/)
## What is Weblate?
When you write a Software, a Website, a Documentation or something else, you may want to translate it, so it can be used by osers, who do not speak English. But you are facing a problem: You did not speak all languages that exist in the World.
Thankfully, there are a lot of native speakers who want to translate things in their language. But not all of those translators are coders, so you can't expect them to go to your your Repo, fork it, edit the Code to make the add the Language
and create a Pull Request. To solve this problem, software like Weblate exists. It provides a easy to use GUI for translators. They just see the English (or the other language you use as a base) texts and can write the translation. They don't need
to take a look at the Code at all, so everyone, not only coders, can translate your Software.
## Do I need to change my Code?
You can't give Weblate your Code and it magically makes it translatable. You need to use an existing translation system such as gettext or Qt Linguist. Which one you should use depends on your used language and toolkit. Take a look at their
documentation to learn more. You should end up with a directory which contains the different translations. Each language should have its own file. e.g. `de.po` for gettext. You now giving Weblate the Link to your Repo and basically
just say, my translations are in this directory and I'm using this format. Weblate does the rest.

View file

@ -0,0 +1,33 @@
---
eleventyNavigation:
key: CodebergTranslateManualComponentConfiguration
title: Manual Component configuration
parent: CodebergTranslate
---
This article will teach how, how to manually configure a Weblate component, in case, it's not working automatically. You will not need this in most cases.
## What is monolingual and bilingual?
Weblate differs into 2 translation formats: monolingual and bilingual.
#### Bilingual
Bilingual means, that the source text live inside the code. See for example the following example from gettext:
```c
printf(_("This is some text"))
```
That means you have language file for the source text. Rather, the source text is in all translation files itself as reference.
#### Monolingual
With Monolingual, you have a extra translation file for your source language.
## Where can I find these Options:
When creating a new Component, you will land on a Page where you can enter them. For existing Components, go to the Component Manage>Settings>Files.
## Configuration options
You have the following options to configure the component:
File format: Choose one of the available formats
File mask: This is the path, in which your translations will be placed `*` is the placeholder for the language. e.g. if you enter `translations/*.ts`, a German translation would be placed as `translations/de.ts`.
Monolingual base language file: If you have a Monolingual format, enter the path to your source file here. If not, leave empty.
Edit base file: If you enable this, the source file can be edited in Weblate. If not ticked, it is read only in Weblate. Only available for monolingual formats.
Adding new translation: You can choose, what happens, if a User wan's to add a new language. The Options should be self-explanatory.
Template for new translations: If you choose "Create new language file" in the Box above, this file will be used as a template.