Howto:Translating innovaphone internal web pages

From innovaphone wiki
Jump to navigation Jump to search

Obsolete

This article is obsolete. Please go to Howto:Translating_innovaphone_applications.

Overview

Some of the internal innovaphone PHP web pages have a multi-lingual interface. This article is for translators and describes how to prepare a translation. Translatable PHP pages will use a tool to implement a multi-lingual user interface that is table driven. A single language is defined by one or more language table files. These files each include a table of pairs of original strings (as found in the original PHP source code) and their respective translations. To translate a web site, these tables must be edited.

As a translator, you will thus receive a set of files that you need to edit with a standard text editor and return to us. If you happen to be a PHP developer too, you may of course consider to use a PHP syntax editor, as this table in fact is a valid PHP source.

Table Format

Each file looks like the following German example

<?php
    //
    // lang-inputpage-de.txt for language 'inputpage_de'
    // updated by translator.php at Fri, 25 Apr 2008 17:46:50 +0200
    //

    // change the right hand side of the pairs in the array below

    // an entry marked as '@missing' needs to be translated: the next 2 lines contain 
    //                                                      the original string and the syntax already
    // an entry starting with '@xyz@...' must retain this tag also in the translation.  This tag will not
    //                                                      show up in the user interface and serves to 
    //                                                      distinguish different translations for a single string

    // If a translation is identical to the original (e.g. 'Name' in English to 'Name' in German), tag the translation with '@@':
    //                 'Name' => '@@Name'                   
    //                                                      to mark it as translated

function _translator_inputpage_de(&$target) {

    $target = array (
    // inputpage.class.php/348: 
        "A phone number starts with an optional '+' followed by digits with decoration such as '/()- ' " 
     => "Eine Telefonnummer beginnt mit einem optionalen  '+' gefolgt von Ziffern mit Trennzeichen wie '/()- ' ",

    // inputpage.class.php/521: 
        "Check if you agree" 
     => "Kreuzen Sie hier an, wenn Sie zustimmen",

...

The beginning of the file up to the $target = array ( line is left unchanged. The remainder of the file consists of the entries to be translated in the following format

  • a comment line with various hints regarding the translatable string. Such hints include
    • the place in the source where the string appears (e.g. inputpage.class.php/348)
    • a @missing tag indicating that the translation is missing
    • a @new tag indicating that the string has been added to the application since the last translation was prepared
    • a @unused tag indicating that the string has a translation but is not used in the application
  • the original string
  • the translated string

All strings are sorted alphabetically. When a translation is marked as unused, then it might be useful to look for a missing one next to it, as the original string in the application may have changed slightly (e.g. for fixing a typo).

In the above example, the string "Check if you agree" is translated to "Kreuzen Sie hier an, wenn Sie zustimmen".

When a translation is missing, the entry is present nevertheless, but the translated string is identical to the original string. E.g.

    //     @missing; @new; innoinputpage.class.php/195: 
          "Please enter a serial number here" 
       => "Please enter a serial number here", 

You would then replace the translated string (the string after the =>) with your translation and leave the original string as-is.

Please be sure to not change anything but the translated string, otherwise the file will not work and has to be fixed manually on our end.

Special Cases

Identical Translations

In some cases, the translated string may be identical to the original string. In such a case, the system would falsely assume that the translation is missing. So if you determine that the string does not need to be translated, add a @@ as first 2 characters of the translation, e.g.

    //     @missing; @new; sample.php/15: 
          "Windows Server" 
       => "@@Windows Server", 

Strings with variables

Sometimes, strings include variables. Consider

    //     
          "The time is {$arg[1]} now." 
       => "Es ist jetzt {$arg[1]} Uhr.", 

The {$arg[1]} syntax will be replaced by the current time on runtime. In your translation, you need to keep this syntax unchanged. However, in certain cases where more than one variable is substituted, the order of variables in the translation may differ from the order of variables in the original string due to different grammar. In this case, you may re-order the appearance of ${arg[n]} syntax. Consider the phrase "You must {$arg[1]} pretty {$arg[2]}." where {$arg[1]} is substituted with a verb and {$arg[2]} with an adverb (e.g. "You must run pretty fast"). The German translation would be "Du musst ziemlich schnell laufen", so we end up with

    //     @missing; sample.php/25: 
          "You must {$arg[1]} pretty {$arg[2]}" 
       => "Du musst ziemlich {$arg[2]} {$arg[1]}.", 

(the verb and adverb has to be translated separately of course).

Long Strings

Sometimes, strings can get quite long and even spread over several lines. Such strings are not treated differently. However, the resulting syntax might be quite confusing as this example shows:


    // mantis.php/364: 
        ' <h1>RMA Request {$arg[1]}</h1>
	<p>
	You have requested a returned material authorization for device {$arg[2]}. The RMA-ID assigned to this issue is {$arg[1]}.
	We will contact you soon using the technical contact information quoted below.
	<span class="alert">Please do not ship the device to us unless you have been instructed to do so</span>!  
	{$arg[29]}
	<p>
	If the device needs to be sent to innovaphone, 
	please be sure to clearly mark it with this RMA-ID.  Send to:
	<p style="margin-left: 10px">
	innovaphone AG<br>
	Reparaturen<br>
	Böblinger Str. 76<br>
	D71065 Sindelfingen<br>
	{$arg[26]}<br>
	<p>
	Please find the details of your submission for your reference below .
	<p>
	<h2>Contact Information</h2>
	<p>
	You have requested RMA on behalf of {$arg[3]} ({$arg[4]}), {$arg[6]} {$arg[7]}.
	<p>
	<h3>Administrational Contact</h3><p style="margin-left: 10px">
	{$arg[8]}<br>
	<a href=mailto:{$arg[10]}>{$arg[10]}</a><br>
	{$arg[9]}
	<p>
	<h3>Technical Contact</h3><p style="margin-left: 10px">
	{$arg[11]}<br>
	<a href=mailto:{$arg[13]}>{$arg[13]}</a><br>
	{$arg[12]}
	<p>
	<h3>Shipping address</h3>
	<p>Any shipment (such as repaired device) regarding this issue will be done to<p style="margin-left: 10px">
        {$arg[19]}<br>
        Attn. {$arg[18]}<br>
        {$arg[17]}<br>
        {$arg[16]} {$arg[15]}<br>
        {$arg[14]}<br>
	<h3>Contacting innovaphone</h3>
	<p>
	If you need to contact us regarding this issue, please send email to <a href="mailto:{$arg[21]}">to support@innovaphone.com using ###{$arg[1]}### within the subject</a>.
	<h2>Device Information</h2>
	<p>
	The defect device serial number is {$arg[2]} ({$arg[23]}).<br/>
	You {$arg[28]} want the identical device to be repaired and returned to you.<br>
	You declared the device {$arg[22]}to be dead-on-arrival.<br/>
	You are assuming that it is {$arg[24]} under warranty.<br/>

	<h2>Problem Description</h2>
	<p>
	<style="margin-left: 10px; font-family:Courier,monospace">{$arg[25]}
	<p>
	<p> 
	<p>
	Yours sincerley, innovaphone AG
	<p>
	{$arg[27]}
	' 
     => ' <h1>RMA Auftrag {$arg[1]}</h1>
	<p>
	Sie haben uns einen Reparaturauftrag für das Gerät {$arg[2]} erteilt. Die diesem Auftrag zugeordnete RMA-Nummer ist {$arg[1]}.
	Wir werden uns in Kürze mit Ihnen über den unten angegebenen technischen Kontakt in Verbindung setzen.
	<span class="alert">Bitte senden Sie das Gerät nicht ein, bevor Sie von uns eine entsprechende Aufforderung erhalten haben</span>!  
	{$arg[29]}
	<p>
	Wenn das Gerät an innovaphone gesendet werden muss, 
	stellen Sie bitte sicher, dass die RMA-Nummer klar erkenntlich ist.  Die Versandadresse lautet:
	<p style="margin-left: 10px">
	innovaphone AG<br>
	Reparaturen<br>
	Böblinger Str. 76<br>
	D71065 Sindelfingen<br>
	{$arg[26]}<br>

	<p>
	Zu Ihrer Information finden Sie nachfolgend die Daten, die wir zu Ihrem Auftrag notiert haben.

	<p>
	<h2>Kontakt</h2>
	<p>
	Sie haben den Reparaturauftrag im Namen von {$arg[3]} ({$arg[4]}), {$arg[6]} {$arg[7]} erteilt.
	<p>
	<h3>Administrativer Kontakt</h3><p style="margin-left: 10px">
	{$arg[8]}<br>
	<a href=mailto:{$arg[10]}>{$arg[10]}</a><br>
	{$arg[9]}
	<p>
	<h3>Technischer Kontakt</h3><p style="margin-left: 10px">
	{$arg[11]}<br>
	<a href=mailto:{$arg[13]}>{$arg[13]}</a><br>
	{$arg[12]}

	<p>
	<h3>Lieferadresse</h3>
	<p>Alle Sendungen (z.B. das reparierte Gerät, resp. ein Ersatzgerät) zu diesem Auftrag werden an folgende Adresse gerichtet:<p style="margin-left: 10px">
        {$arg[19]}<br>
        Z.Hd. {$arg[18]}<br>
        {$arg[17]}<br>
        {$arg[16]} {$arg[15]}<br>
        {$arg[14]}<br>

	<h3>Mit innovaphone Kontakt aufnehmen</h3>
	<p>
	Falls Sie uns bezüglich dieses Auftrags kontaktieren wollen, senden Sie eine Email <a href="mailto:{$arg[21]}">an support@innovaphone.com mit ###{$arg[1]}### im Betreff</a>.

	<h2>Geräteinformation</h2>
	<p>
	Das defekte Gerät hat die Seriennummer {$arg[2]} ({$arg[23]}).<br/>
	Sie wollen {$arg[28]} das selbe Gerät repariert zurück erhalten.<br>
	Sie haben angegeben, dass das Gerät {$arg[22]}von Anfang an defekt war.<br/>
	Sie nehmen an, dass das Gerät {$arg[24]}sich innerhalb der Garantiezeit befindet.<br/>

	<h2>Problembeschreibung</h2>
	<p>
	<style="margin-left: 10px; font-family:Courier,monospace">{$arg[25]}
	<p>
	<p> 
	<p>
	Mit besten Grüßen,
	innovaphone AG
	<p>
	{$arg[27]}
	',