Skip to content

Commit

Permalink
Update translation docs (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdoming authored Jan 11, 2025
1 parent 677c227 commit 4fd70ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ABNAMRO
ABNANL
Activo
Anglais
AESUDEF
ALZEY
BANKA
Expand Down
26 changes: 18 additions & 8 deletions docs/contributing/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@

Are you interested in bringing Actual to a broader audience by translating and localizing the app into new languages? Great! This guide will show you how to get started. Adding translations can be a great first step into contributing to open-source software.

:::warning Community translations
## Translating existing strings

Currently, Actual Budget **is not yet ready** to receive community translations.
Actual uses [Weblate](https://hosted.weblate.org/projects/actualbudget/actual) to manage all translations. In particular, we use Weblate's "suggestions" system to maintain high-quality translations.

:::note Pull Requests

We do not accept GitHub Pull Requests modifying translation files—any PRs in the translations repository will be automatically closed.

:::

## Current Status
### Suggesting a new translation

To suggest a translation for a language you are familiar with, just find a string you'd like to translate, fill in a translation, and hit "Suggest." This will then give others the opportunity to vote on the most accurate translation. Check out the [Weblate docs](https://docs.weblate.org/en/latest/user/translating.html) for more details.

Please only fill in translations that you are confident in, and be sure to include the same formatting markers as the English text (example: `<1>English</1>` -> `<1>Anglais</1>`).

### Voting on existing suggestions

Actual is currently being prepared for internationalization (i18n). This means that initially everything in the app was English, but we're slowly marking all texts for translation.
To help vote on high-quality strings, click on "Strings with suggestions" from a language page, and use the thumbs-up or thumbs-down icons to vote. If you click thumbs-down, it's always helpful to provide a reason so that the original translator can improve.

## Marking for Translation
## Marking new strings for translation

Developing translated software requires that every text shown to the user passes through a translation function. Actual uses [i18next](https://www.i18next.com/) to achieve this goal.

Expand All @@ -38,7 +48,7 @@ import { useTranslation } from 'react-i18next';
function MyComponent() {
const { t } = useTranslation();

return <p>{t('Hello World')}</p>;
return <button aria-label={t('Hello World')} />;
}
```

Expand All @@ -48,7 +58,7 @@ At runtime, it will select the translation from the currently active locale. You
const withPlaceholder = t('Welcome home, {{name}}!', { name: 'Anita' });
```

For [pluralalization](https://www.i18next.com/translation-function/plurals), please use the plural form for the default text. The placeholder variable **must** be named `count`:
For [pluralization](https://www.i18next.com/translation-function/plurals), please use the plural form for the default text. The placeholder variable **must** be named `count`:

```javascript
const manyItems = t('You selected {{count}} items', { count: 4 });
Expand All @@ -58,7 +68,7 @@ i18next will take care of proper pluralization rules in the currently active lan

### `<Trans>` Component

When translating text with simple HTML tags or other React components, you will need to use the [`<Trans>` component](https://react.i18next.com/latest/trans-component).
When translating text with simple HTML tags or other React components, we ask that you use the [`<Trans>` component](https://react.i18next.com/latest/trans-component).

```javascript
import { Trans } from 'react-i18next';
Expand Down

0 comments on commit 4fd70ca

Please sign in to comment.