RSS

Forums/Service

API

Get Localization Apr 01

GetLocalization API

 

Retrieve list of product languages

URL 

Parameters

    Name        Required        Method      Description
product            Yes                GET             The product name        
type                 No                 GET             The data output format (accept 'text' or 'xml') Default is 'text'


Data Output

if type is 'text', the output data will be in plain text and each language is on each line with 
language description and iana code separated by a comma (,)


English (United States), en-US
Finnish, fi
Vietnamese, vi-VN


if type is 'xml', the output data is in following XML format,


<Languages>
    <Language>
        <Name>English (United States)</Name>
        <IanaCode>en-US</IanaCode>
    </Language>
    <Language>
        <Name>Finnish</Name>
        <IanaCode>fi</IanaCode>
    </Language>
    <Language>
        <Name>Vietnamese</Name>
        <IanaCode>vi</IanaCode>
    </Language>
</Languages>

Error Codes

    HTTP Status Code        Error Message
        400                            Type is invalid
        400                            Product name is invalid
        400                            Product is not specified

Examples


Will retrieve the languages created for GoogaSync product in XML format


Retrieve translations in binary format

URL 

Parameters

    Name        Required        Method      Description
product            Yes                GET             The product name        
iana                 Yes                GET             The language iana code


Data Output

The data output in binary format. 
For each master string and a translation, 
The first 4 bytes is the length of the master string (number of Unicode characters)
Next n bytes is the master string in Unicode, encoding in UTF-8 (litte endian)
The next 4 bytes is the length of the translations (number of Unicode characters)
Next n bytes is the translation in Unicode, encoding in UTF-8 (litte endian)


Error Codes

    HTTP Status Code        Error Message
        400                            Iana code is not specified
        400                            Iana code cannot be found
        400                            Product name is invalid
        400                            Product is not specified


Examples


Will retrieve the translations in Finnish for GoogaSync product i


Retrieve translations in XML

URL 

Parameters

    Name            Required        Method          Description
productName            Yes                GET             The product name        
iana_code                 Yes                GET             The language iana code


Data Output

The data output in XML format, the list of all information of a master string
<GLStrings>
    <GLString>
        <MasterString>Hello There</MasterString>
        <LogicalString>hello_there</LogicalString>
        <ContextInfo>Front page menu</ContextInfo>
        <Translation>Moi</Translation>
    </GLString>
</GLStrings>


Error Codes

In case of error, the following data is returned,
<errors>
    <error_message>Iana code does not exist</error_message>
</errors>


Examples

Will retrieve the master strings & translations in Finnish for GoogaSync product i

 

Retrieve the strings in JSON format 
URL:
    /api/js/localizations/?product=<pname>&component=<cname>&locale=<iana_code>
Parameters:
Name            Required        Method          Description
pname             Yes                GET             The product name
cname             Yes                GET             The component name        
iana_code        Yes                GET             The language iana code
Data Output:
The data output is in JSON format with the root object String.toLocaleString
For example:
String.toLocaleString({ "fr" : { "Hello": "Bonjour", "Exit" : "Sortie" }})

Retrieve the strings in JSON format 

URL:

    /api/js/localizations/?product=<pname>&component=<cname>&locale=<locale>

Parameters:

Name            Required        Method          Description

pname             Yes                GET             The product name

cname             Yes                GET             The component name        

locale               No                 GET             The language code

* If locale parameter is not specified, output data contains localizations for all languages in the product.

 

Data Output:

The data output is in JSON format 

For example:

{ "fr" :

    { "Hello": "Bonjour",

      "Exit" : "Sortie" }

}

 

Add or update new strings to product

URL 

Parameters

The POST data is in XML format, required to have following information

 

<Language>{ Iana_Code }</Language>
<Type>{ Type }</Type>
<Product>{ Product }</Product>

<GLString>

    <String></String>
    <LogicalString></LogicalString>
    <ContextInfo></ContextInfo>
    <MaxLength></MaxLength>
</GLString>

 

Type : 'Master' then String element will be the master string. Otherwise, string element is considered as Translation


Data Output

The data output in XML format, the list of all information of a master string
<GLStrings>
    <GLString>
        <MasterString>Hello There</MasterString>
        <LogicalString>hello_there</LogicalString>
        <ContextInfo>Front page menu</ContextInfo>
        <Translation>Moi</Translation>
    </GLString>
</GLStrings>


Error Codes

200    Success
404    Fail


Examples