Help:Adding a Language

From Pathfinder Wiki
Revision as of 03:59, 30 January 2021 by Jomegat (talk | contribs) (Created page with "==Introduction== This wiki uses the Translate extension which is described at Help:Translation. You should read that first. This page describes some of the things we di...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

This wiki uses the Translate extension which is described at Help:Translation. You should read that first. This page describes some of the things we did to make translation easier.

Steps

The first thing to do when adding a new language to the wiki is to edit Template:GetLangSuffix. The template is protected though, so you may need to leave a request in the Discussion page. Administrators patrol this wiki daily, so one of us will see the request soon after you leave it.

The GetLangSuffix template returns text like /es or /de depending on where it is invoked from. It basically extracts the last element of the page name, runs it through a #switch statement, and returns a slash plus the language code if it recognizes the last element as a language code. If it is invoked from an English page, or from a page that it doesn't recognize as a translated page, it will return an empty string. Whatever it returns - an empty string, or a language code - can be tacked to the end of any page title to refer to the translated version of that page. This technique is used extensively throughout the wiki.

The next step is to go to the Localization:All page, and create a translation for the new language. This page is a list of words and phrases that we use in templates so that we don't have to translate the templates. Templates can be very complex, and they are difficult to get right. Most templates will display text to the user by having that text in the localization page, and then using the Template:Localize template which will fetch the tranlated phrase based on the results returned by {{GetLangSuffix}}. For example:

{{Localize:Honor}}

will return this:

Template:Localize:Honor

Which is admittedly not that impressive - except that if you call if from a page ending in /es, it will return "Especialidad" which is the Spanish translation of the word "Honor". That makes it quite magical.

The phrases in Localization:All are used to display the names of the tabs, the names of the hierarchical names of the SDA Church organiation (i.e., General Conference, North American Division, etc), the honor categories, the names of the Master Awards, and basically, anything we want to display in a template.

Summary

So basically, to add a new language to the wiki, request that it be added to Template:GetLangSuffix, and then translate Localization:All to the new language. Once that's done, you can start translating regular pages.