Difference between revisions of "Help:Adding a Language"

From Pathfinder Wiki
Line 28: Line 28:
 
==Language Specific Graphics==
 
==Language Specific Graphics==
 
When translating [[:Localization:All]], you might notice that "No Patch" and "Not Available at AdventSource" contain file names instead of text.  These graphics contain text, so a new localized version of the graphic needs to be created too.
 
When translating [[:Localization:All]], you might notice that "No Patch" and "Not Available at AdventSource" contain file names instead of text.  These graphics contain text, so a new localized version of the graphic needs to be created too.
 +
 +
==Choose a default Bible Version==
 +
[[:Template:Bible link]] takes a Bible verse as a parameter and converts that to a link to [http://biblegateway.com biblegateway.com].  This template cannot use [[:Localization:All]] to pass in the Bible version because of the additional wiki markup that is added to everything the <nowiki>{{Localize}}</nowiki> template must return.  This extra text is ignored by the wiki rendering software, but we need to use it to specify which version of the Bible is to be used, and the text gets added to a URL.  URLs don't ignore wiki markup, so this operation fails.  So we had to take a different approach.
 +
 +
You will need to first figure out what version string [biblegateway.com] needs to query a language-specific Bible translation.  In English, this string is NKJV.  Once you know what string you need to use, create a file in <nowiki>[[</nowiki>Localization:Default Bible verse/''language code'']].  The only thing that should be placed in the file is the string biblegateway.com needs.  Do not use the Translation extension to create this file.
  
 
==Summary==
 
==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.
 
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.

Revision as of 01:19, 3 February 2021

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

GetLangSuffix

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.

Localization:All

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 translated phrase based on the results returned by {{GetLangSuffix}}. For example:

{{Localize|Honor}}

will return this:

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. It's important to note that the argument passed to the Localize template be in English, and that it have the correct unit name. Spelling and case are important. What this means is that you should not expect

{{Localize|Especialidad}}

to work. The name of the phrase is "Honor" and it doesn't matter what language you invoke it from.

The phrases in Localization:All are used to display the names of the tabs, the names of the hierarchical names of the SDA Church organization (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. If a user is going to see it, it should be in Localization:All.

Each entry in Localization:All is tagged as a section so that it can be extracted as a unit. We've already shown how to extract a unit from this file by using Template:Localize. If we want to add new text to a template, we need to add it to this file, and then translate it (or request a translation) in all the supported languages. Each unit is surrounded by section tags which is how they are identified by the Localize template. Because these words and phrases are used so widely, editing it reserved for administrators, so if you need to add a unit, let us know. Inside the section tags are <translate> tags which identify which part of the entry needs to be translated. But because both of these translate tags are actually displayed when they are included, the <translate> and </translate> tags have to be individually wrapped in <nowiki><noinclude> and </noinclude> tags. It's ugly, but it works and it's powerful.

Language Specific Graphics

When translating Localization:All, you might notice that "No Patch" and "Not Available at AdventSource" contain file names instead of text. These graphics contain text, so a new localized version of the graphic needs to be created too.

Choose a default Bible Version

Template:Bible link takes a Bible verse as a parameter and converts that to a link to biblegateway.com. This template cannot use Localization:All to pass in the Bible version because of the additional wiki markup that is added to everything the {{Localize}} template must return. This extra text is ignored by the wiki rendering software, but we need to use it to specify which version of the Bible is to be used, and the text gets added to a URL. URLs don't ignore wiki markup, so this operation fails. So we had to take a different approach.

You will need to first figure out what version string [biblegateway.com] needs to query a language-specific Bible translation. In English, this string is NKJV. Once you know what string you need to use, create a file in [[Localization:Default Bible verse/language code]]. The only thing that should be placed in the file is the string biblegateway.com needs. Do not use the Translation extension to create this file.

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.