Help:Extension:Translate/Group configuration example/ak

Saa nkyerɛkyerɛ yi yɛ ma developers ne nkyerɛaseɛ so ahwɛfoɔ a wɔakɔ anim. This tutorial explains how to create new configuration files for software interface message translation, detailing the practical aspects of it. Ɛsɛ sɛ wode bedi dwuma abom ne kuo nhyehyeɛ nkyerɛkyerɛmu nwoma na wɔn a wɔyɛɛ ntrɛmu no de anigyeɛ bɛboa wo wɔ nsɛmmisa biara a wowɔ ho bere a woayɛ adwuma wɔ nkyerɛkyerɛ yi mu awie no.

Nneɛma a ɛsɛ sɛ wodi kan yɛ

 * the Translate extension and
 * no.

Wɔayɛ saa nkyerɛkyerɛ yi a egyina ntrɛwmu nsakrae r97948 (2011-09-23) so.

Saa nkyerɛkyerɛ yi kyerɛkyerɛ ɔkwan a wɔfa so ma nkyerɛase tumi yɛ MyBB adwuma no afa horow bi. Wubetumi adi anammɔn a ɛte saa ara akyi de nnwuma/fael afoforo aka ho ama nkyerɛase. Nneɛma bi yɛ translatewiki.net pɔtee na ɛsɛ sɛ wode nea ɛfa wo ho no di dwuma fi awosu mu, sen sɛ wubedi nkyerɛkyerɛ yi anammɔn akyi anifurae so.

Step 1: Check out source code
Let's check out the MyBB source code using  as working directory, which is   in this example.

Afei ɛsɛ sɛ yɛhwehwɛ fael ahorow a nkrasɛm ahorow no wom no. Wɔwɔ  subdirectory no mu, na wobɛtumi ahunu Twi farebae nkrasɛm no wɔ   subdirectory no ase.

Enti momma yɛnhyɛ aseɛ mfa, yɛn adwuma no localization fael a ɛdi kan.

Step 2: File Format Support
Wɔ yɛn MediaWiki instɔlehyɛn daerekta mu no, wɔ  ne    ase no yebetumi ahu adesua ahorow a ɛfa fael format mmoa ho, a wɔde yɛ map nkra akuw kɔ localization fael ahorow so adwuma biara ho. Ɛsɛ sɛ woyɛ digging kakra na woahu ankasa sɛ formats ko a wɔboa. Enti yɛsi gyinae kɛkɛ sɛ yɛbɛbɔ mmɔden na yɛde FlatPhpFFS adesua no adi kan adi kan na yɛahwɛ sɛnea ɛyɛ adwuma yiye wɔ yɛn PHP fael no ho.

Enti yɛwɔ fael a yɛde bɛyɛ map na yɛapaw FFS class no ama no. Afei ɛsɛ sɛ yɛkyerɛw kuw nhyehyɛe bi. Ɛno yɛ YAML fael.

Wɔ mu no wobɛtumi ahunu link a ɛkɔ. Momma yɛnhyɛ aseɛ mfa fael a ɛsua koraa a wɔde ama sɛ nhwɛsoɔ ama MFIASESƐMɔfa no.

Yebetumi akɔ yɛn anim na yɛde yɛn ankasa gyinapɛn ahorow asi nhwɛso nkyerɛwee no ananmu kɛkɛ.

Nkyerɛkyerɛmu no gye wikitext syntax nyinaa tom. Afiri fɛfɛ baako a wɔakyerɛ wɔ mfitiaseɛ nhwɛsoɔ no mu ne sɛ wobɛtumi ama no atumi akyerɛ aseɛ denam a wode bedi dwuma no so. Nanso afei ɛsɛ sɛ wokyerɛkyerɛ default text no mu wɔ krataafa MediaWiki:Message-key no mu. Hyɛ no nsow sɛ wɔde edin atenae ID no nam ne daa so aka ho, hwɛ sɛnea wode edin atenae a wɔahyɛ da ayɛ di dwuma.

Yɛhia adeɛ baako bio:  ɔfa no. Bio nso fi ase fi nhwɛso a wɔde ama wɔ nkrataa no mu no so:

Hmm,  is the language code, like   by default. For now, we do not want to change the directory structure used by MyBB. Instead we can use a feature designed for this purpose: the code map, which allows us to map language codes of each language to the identifiers used by our project.

Enti yekowie sɛ:

Basically this says that for code, the   in above will be  , which is the directory for the English message files. The key  is usually the same as , but without the   prefix.

Good. Now let's save this file somewhere, for example to the same folder where is stored, with name. The whole file is:

Papa. Afei momma yɛmfa saa fael yi nsie baabi, sɛ nhwɛso no, nkɔ folda koro no ara a wɔde $1 asie no mu, a edin $2 wom. Fael no nyinaa ne:

Sɛ woyɛ eyi wie a, di akwankyerɛ a ɛwɔ no akyi na fa   script no di dwuma.

Enti momma yɛnkɔ mu, hwɛ sɛ ɔdefoɔ no wɔ "translate-manage" hokwan wɔahyehyɛ no yie, na kɔ Special:ManageMessageGroups.

Ebia wubehu eyi:

No valid namespace defined, got NS_MYBB. Backtrace: <...>

Wɔ saa tebea yi mu no, sɛ wokenkan nkrataa no yiye a, anka wubetumi ahu hia a ehia sɛ wode nkyerɛwde a edidi so yi ka  ho de kyerɛw dinbea foforo no wɔ MediaWiki:

Wɔ saa nhwɛso yi mu no wɔde 1246 na edi dwuma, nanso wubetumi apaw dinbea nɔma biara a wontua hwee a wuhia. Sɛ wopɛ Translate ntrɛwmu no a, yɛhyɛ nyansa sɛ fa even namespace nɔma 1200-1298 di dwuma.

Sɛ afei wosan de ManageMessageGroups krataafa titiriw no gu mu a, ɛsɛ sɛ wuhu line bi a ɛka sɛ:

MyBB This message group has not been imported previously.

Klik MyBB link no so. Ɛno akyi no, wubehu nkrasɛm ahorow a ɛwɔ saa fael no mu no din. Sɛ w'ani gye nea efi mu ba no ho a, klik "Execute".

Sɛ wo klik "Execute" wie a, wɔyɛ fael no ho adwuma na wubehu output a ɛte sɛ eyi:

Imported new version of page MyBB:L\x5b'boardstats'\x5d/en. Imported new version of page MyBB:L\x5b'new posts'\x5d/en. Imported new version of page MyBB:L\x5b'no new posts'\x5d/en. ... Cache rebuild. All done!

Sɛ fael no sõ yiye a, ɛsɛ sɛ wudi kan tu mmirika, efisɛ wɛb ntamgyinafo no betumi de nkra dodow bi aba prɛko pɛ esiane PHP bere a ɛtwam anohyeto no nti; sɛ wuhyia anohyeto yi a, wubetumi akliki bɔtn bi a ɛwɔ kratafa no ase no so de nkrasɛm a aka no aba.



Anamɔn 3: Fael foforo a wode bɛka ho
Afei momma yɛmfa fael a ɛtɔ so mmienu nka ho mma MyBB mma nkyerɛaseɛ. Akwan abien na ɛwɔ hɔ a wobɛfa so ayɛ eyi:



Ɔkwan 1: YAML fael foforo a wode bɛka ho
Fa YAML fael foforo ka ho kɛkɛ na wode din foforo sie. Afei frɛ no fi  mu na di atifi hɔ anammɔn no nyinaa akyi. Fael no bɛyɛ biribi te sɛ eyi:

Sɛnea ɛda adi wɔ atifi hɔ nhwɛso no mu no, ɛsɛ sɛ wode ID soronko di dwuma ma kuw foforo yi.

Ɛwom sɛ ɛyɛ mmerɛw de, nanso saa kwan yi ntumi nkɔ nkyerɛase akuw ahorow ɔhaha pii (i.e. fael ahorow a wɔayɛ ho mfonini wɔ wɔn nkra kuw no mu). Ɛdu baabi a ɛsɛ sɛ wo update value bi, na sɛ wobɛyɛ ama saa fael ahorow no nyinaa a, ɛnyɛ anigye. Nea eye ne sɛ ɔkwan foforo bi wɔ hɔ, a wɔakyerɛ wɔ ase ha.

Approach 2: TEMPLATE syntax
Adwene no ne sɛ yɛbɛtwe gyinapɛn ahorow a wɔtaa de di dwuma no akɔ nsusuwso bi mu. Afei kuw biara bɛfa values a ayera afi template no mu na ɛho nhia sɛ wɔsan yɛ no bio ma kuw biara.

Momma yɛnsan nkɔ MyBB nhwɛso no so. Momma yɛnka sɛ wopɛ sɛ wode,   ne   ka nkra a wobetumi akyerɛ ase no ho. Ɛsɛ sɛ wɔyɛ YAML fael no foforo te sɛ eyi:

Sɛnea ɛda adi wɔ atifi hɔ nhwɛso no mu no, wɔakyerɛkyerɛ  mu pɛnkoro pɛ; fael ahorow a wode bɛka ho na woayi afi hɔ no yɛ mmerɛw te sɛ nea wode ɔfã bi bɛka ho anaasɛ wubeyi afi fael a ɛwɔ atifi hɔ no mu.

Afei sɛ wokɔ ManageMessageGroups krataafa titiriw no so a, wubehu nneɛma abiɛsa te sɛ eyi:

MyBB global messages: This message group has not been imported previously. MyBB index page: This message group has not been imported previously. MyBB show thread: This message group has not been imported previously.

Sɛ fael pii wɔ hɔ a ɛsɛ sɛ wode ka wo project no ho a, ebia ɛbɛyɛ adwene pa sɛ wobɛkyerɛw script a ɛde wo YAML fael no bae maa wo. Wobetumi ahu nhwɛso bi wɔ $kratafa mu.



Anamɔn 4: Ka kuw no bom
Sɛ wode kuw a wɔaka abom bɛka ho na woakyerɛ nkrasɛm fael ahorow no ase sɛ ne akuw nketewa no wɔ mfaso abien:


 * Adwuma kakraa bi ma nsɛm asekyerɛfo de paw nkrasɛm akuw ahorow, titiriw ma nsiesie adwuma. Nsɛm asekyerɛfo betumi abue kuw a wɔaka abom no ara kwa na wɔakyerɛ ase anaasɛ wɔayɛ biribiara a ehia sɛ wɔyɛ no foforo anaa wɔkyerɛ ase ma akuw no nyinaa ase foforo.
 * Wobetumi abɔ akontabuo ho amanneɛ wɔ kuw a wɔaka abom no gyinabea, i.e. adwuma no nyinaa.

In order to define an aggregate group, you need to add the following section right after the TEMPLATE section and before the definition of individual subgroups:

Eyi ma yɛbɛn yɛn yiye, nanso anammɔn biako da so ara yera. Saa berɛ yi, sɛ wokɔ Special:Translate a, wobɛhunu MyBB awofoɔ kuo no (na nokwarem no ɛyɛ adwuma!) nanso akuo nketewa a wɔakyerɛw sɛ akuo ahodoɔ nso. :(

Eyi ne ɔkwan a wɔfa so siesie. Fa nkyerɛwde a edidi so yi ka wo  ho:



This takes all groups whose id match the given pattern, shows the first group, and hides everything else below that first group. A bit ugly, but it works. This construction only supports two layers, even though aggregate groups can be part of aggregate groups.

If you go to Special:Translate now, you will only see the parent group MyBB listed. Additionally, you will see a link "Show 3 subgroups"; clicking on that will show you the names of subgroups.

Check out the manual for TAGS and other sections we didn't go through in this document.

Step 5: Cleaning up
YAML files of projects supported by translatewiki.net are committed to the repository on Git.

In translatewiki.net, the  lines are actually in. Sandboxwiki at translatewiki.net does not have a  file, which is why we added everything in.