Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update language-packs.md #464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/extend/language-packs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

:::info

This documentation covers the technical structure of language packs. Read [this article](../contributing-docs-translations.md) for information on how to start / contribute to a Flarum language pack.
This documentation covers the technical structure of language packs. Read [this article](../contributing-docs-translations.md) for information on how to start/contribute to a Flarum language pack.

:::

## Declaring a Language Pack

Language packs should be their own extensions, with no other code / logic included.
Language packs should be their own extensions, with no other code/logic included.

The [`LanguagePack` extender](https://github.com/flarum/framework/blob/main/framework/core/src/Extend/LanguagePack.php) allows you to define that your extension is a language pack.

This extender has no setters. All you have to do is instantiate it, make sure you language pack is in the `locale` folder, and you're done!
This extender has no setters. All you have to do is instantiate it, make sure your language pack is in the `locale` folder, and you're done!

Here's a quick example from [Flarum English](https://github.com/flarum/lang-english/blob/master/extend.php):

Expand All @@ -37,15 +37,15 @@ And that's it! It should work out of the box.

Translation files should go in the `locale` directory. Each file should be named `EXTENSION_ID.yml`, where EXTENSION_ID is the [extension's ID](admin.md#telling-the-api-about-your-extension).

The contents of the file should correspond to the extension's english translations, with the values translated in your language. See our [internationalization](i18n.md) docs for more information.
The contents of the file should correspond to the extension's English translations, with the values translated into your language. See our [internationalization](i18n.md) docs for more information.

## DayJS Translations

Flarum use [the DayJS library](https://day.js.org/) to format and internationalize dates.
Flarum uses [the DayJS library](https://day.js.org/) to format and internationalize dates.

You can create a `config.js` file in the `locale` directory to configure date internationalization for your language.

The file should look like:
The file should look like this:

```js
dayjs.locale('xx');
Expand Down