Files

Endpoints for working with Localazy files.

About Files 🔗

Each imported key must be stored inside a file. In Localazy, a file is a set of keys and their translations.

One file in Localazy can represent several discrete files. E.g., file localization.json in Localazy can be stored as localization_en.json, localization_cs.json, and localization_de.json on your filesystem.

Complex Files 🔗

To support advanced features such as Android product flavours and dynamic app modules, Localazy has a complex mechanism allowing for overlaying and mixing files.

Usually, it’s not needed very ofte, except for our Android and iOS SDKs. However, if such file is present in the project, there may be some limitations when working with it.

List files in project 🔗

[GET] /projects/{projectId}/files
Description Value
Accessible with project token true
Accessible with organization token true
Need write permission false
Available from role translator
API level normal

Returns list of files in the project with all available parameters.

Sample Request 🔗

curl --request GET \
  --url https://api.localazy.com/projects/{projectId}/files \
  --header 'Authorization: Bearer {{token}}'

Sample Response 🔗

[
  {
    "id": "_a58944132124478",
    "type": "api",
    "name": "file.json",
    "path": "path/to/file",
    "module": "module",
    "productFlavors": [
      "free",
      "google"
    ],
    "buildType": "debug"
  }
]

Response Object:

Field Required Description
id required Unique identifier of the file.
type required Type of the file; please refer to file formats. Value complex is used for complex files described above.
name required Name of the file.
path optional Stored path to the file. Optional and only available if provided.
module optional The module the file belongs to. Optional and only available if provided.
productFlavors optional A list of associated product flavours. Optional and only available if provided.
buildType optional A build type the file is associated with. Optional and only available if provided.

List file content 🔗

[GET] /projects/{projectId}/files/{fileId}/keys/{lang}
Description Value
Accessible with project token true
Accessible with organization token true
Need write permission false
Available from role translator
API level normal

Returns a list of keys and their translations in language {lang} from file {fileId}.

Locale code {lang} must be in the format: ll-Scrp-RR.

Query Parameters 🔗

Parameter Description
deprecated=true Returns also deprecated keys.
limit=### Number of keys to be returned in a single call (max 1000). Default 1000.
next=pageId Used for paging long lists.

Sample Request 🔗

curl --request GET \
  --url https://api.localazy.com/projects/{proejctId}/files/{fileId}/keys/en \
  --header 'Authorization: Bearer {{token}}'

Sample Response 🔗

{
  "keys": [
    {
      "id": "_a8503372675164909925",
      "key": [
        "nested",
        "key",
        "is",
        "supported"
      ],
      "value": "Single string value"
    },
    {
      "id": "_a8503372675164909931",
      "key": [
        "plural_key"
      ],
      "value": {
        "@one": "There is only one item.",
        "@other": "There are %d items."
      }
    },
    {
      "id": "_a8503372675164909934",
      "key": [
        "string_list"
      ],
      "value": [
        "Easy",
        "Medium",
        "Hard"
      ]
    }
  ],
  "next": "aA89XITzNpwL"
}
Field Required Description
keys required Array of keys contained in the file in given language. See “Key Object” below.
next optional Next is the paging key. The field is not contained if there are no more pages.

Key Object

Field Required Description
id required Unique Id of the key in Localazy.
key required Aray of key components. For nested keys it contains the separate levels. For simple string keys it contains just one item.
value required Value represents the translation. It can be either string, array or object for plurals.