Localization Object

Introduction

This section talks about the possibility of working with API cloud localization. With cloud localization, you can change the lines within your application on the fly.

If you do not use our SDKs and work via Direct API, please take care of caching data to save the traffic of your users.

Available Methods

Use following methods to work with Cloud Localization:

Object / Method URL Description
Localization.get_locale_list https://cp.ocugine.pro/api/localization/get_locale_list/ Use this method to get locales list for your project.
Localization.get_locale https://cp.ocugine.pro/api/localization/get_locale/ Use this method to get locale data.
Localization.get_lang_list https://cp.ocugine.pro/api/localization/get_lang_list/ Use this method to get languages list for your object.
Localization.get_lang https://cp.ocugine.pro/api/localization/get_lang/ Use this method to get language data.

Get Locales List

In order to get locales list you need to send POST request to:

https://cp.ocugine.pro/api/localization/get_locale_list/

The request parameters should include:

Name Type Desc
app_id double Your Application ID. You can see your Application ID here.
app_key string Your Application Client Key. You can see your Client Key here.

Request Data Example

{
    "app_id": 1,
    "app_key": "example_key"
}

Response Example

{
    "complete": true,
    "message": "",
    "data": {
        "list": [
            {
                "lang_name": "ru",
                "locales": [
                    {
                        "uid": "91",
                        "code": "test-node",
                        "value": "Тестовое значение",
                        "lng": "ru"
                    }
                ]
            },
            {
                "lang_name": "en",
                "locales": [
                    {
                        "uid": "92",
                        "code": "test-node",
                        "value": "Test Value",
                        "lng": "en"
                    }
                ]
            }
        ]
    }
}

The Data object contains List array with Language objects:

Name Type Desc
lang_name string Language Name.
locales array Array of Locales objects

Locales objects contain the following parameters:

Name Type Desc
uid double Global Locale ID
code array Locale Code
value array Locale Value provided by this code

Get Locale

In order to get locale data you need to send POST request to:

https://cp.ocugine.pro/api/localization/get_locale/

The request parameters should include:

Name Type Desc
app_id double Your Application ID. You can see your Application ID here.
app_key string Your Application Client Key. You can see your Client Key here.
lang string Language Code for requested Locale. For Example: "en"
code string Requested Locale Code. For example: "test-node"

Request Data Example

{
    "app_id": 1,
    "app_key": "example_key",
    "lang": "en",
    "code": "test-node"
}

Response Example

{
    "complete": true,
    "message": "",
    "data": {
        "uid": "91",
        "code": "test-node",
        "value": "Тестовое значение",
        "language": "ru",
        "project_id": "59"
    }
}

Where Data object contain the following parameters:

Name Type Desc
uid double Locale Global ID
code string Locale Code
value string Locale Value
language string Language Code
project_id double Project ID for requested Locale

Get Languages List

In order to get languages list you need to send POST request to:

https://cp.ocugine.pro/api/localization/get_lang_list/

The request parameters should include:

Name Type Desc
app_id double Your Application ID. You can see your Application ID here.
app_key string Your Application Client Key. You can see your Client Key here.

Request Data Example

{
    "app_id": 1,
    "app_key": "example_key"
}

Response Example

{
    "complete": true,
    "message": "",
    "data": {
        "list": [
            {
                "uid": "71",
                "code": "ru",
                "name": "Russian",
                "time": "1563971140",
                "project_id": "59"
            },
            {
                "uid": "72",
                "code": "en",
                "name": "English",
                "time": "1563971147",
                "project_id": "59"
            },
            {
                "uid": "75",
                "code": "it",
                "name": "Italian",
                "time": "1566915635",
                "project_id": "59"
            }
        ]
    }
}

The Data object contains List array with Short language info:

Name Type Desc
uid double Global Language ID.
code string Language Code
name string Language Name
time double Language Update Time
project_id array Project ID for this Language

Get Language

In order to get language data you need to send POST request to:

https://cp.ocugine.pro/api/localization/get_lang/

The request parameters should include:

Name Type Desc
app_id double Your Application ID. You can see your Application ID here.
app_key string Your Application Client Key. You can see your Client Key here.
code string Language Code. For example: "en"

Request Data Example

{
    "app_id": 1,
    "app_key": "example_key",
    "code": "en"
}

Response Example

{
    "complete": true,
    "message": "",
    "data": {
        "uid": "72",
        "code": "en",
        "name": "English",
        "time": "1563971147",
        "project_id": "59"
    }
}

Where Data object contain the following parameters:

Name Type Desc
uid double Language Global ID
code string Language Code
name string Language Name
time double Language Update Time
project_id array Project ID for this Language