Well, write down How to make extended language pack for flarum extension.
Requirements
- Editor to write YAML (I don't recommend to use notepad)
- Git
- Packagist account
How to
Step1: Make a repository
Make a repository and init it, then clone it.
Please take a look other site if you have any questions to make git repository.
Step2: Make composer.json
Make composer.json
file in the extension directory.
And then copy and paste these:
{
"name": "Your repository name",
"description": "Your description",
"keywords": [
"set",
"your",
"tags",
],
"type": "flarum-extension",
"minimum-stability": "stable",
"license": "MIT",
"require": {
"flarum/core": "^0.1.0-beta.9"
},
"suggest": {
"n04h/flarum-ext-japanese": "Flarum language package for Japanese."
},
"authors": [
{
"name": "Your name",
"role": "Developer"
}
],
"extra": {
"flarum-extension": {
"title": "Extension title",
"icon": {
"name": "icon name",
}
},
"flarum-locale": {
"code": "en",
"title": "English"
}
}
}
name
: Need. Your repository name, like rikusen0335/lang-japanese-extended
.
description
: Need. Repository description.
keywords
: Not needed. Set whatever you want but related to you extension.
type
: Don't change. This is important.
minimum-stability
: Not needed. Change whatever you want. This uses for badge.
license
: Depends on situation. Set your license.
require
: Need. Set flarum version. Currently, beta.9
is newest.
suggest
: Not needed. Input something like origin language packs.
authors
: Not needed. Set your name and role.
extra.extension.title
: Need. Set extension title.
extra.extension.icon
: Not need. Icon can be set.
extra.locale.code
: Need. Set your locale code. Flarum uses ISO 639-1 code.
extra.locale.title
: Need. This will be displayed on header.
Step3: Make extend.php
Make extend.php
and type this:
<?php
return new Flarum\Extend\LanguagePack();
and then save it.
Step4:
Make locale
folder to extension directory.
Then make file in locale
folder that extension you are going to translate!
References
https://flarum.org/docs/extend/i18n.html#how-flarum-translates