ProjectTranslationsMixin

class squirro_client.topic.ProjectTranslationsMixin

Bases: object

Methods Summary

get_project_translations(project_id[, language])

Get language translations for the provided project.

modify_project_translations(project_id, …)

Update language translation set.

new_project_translations(project_id, …)

Create new language translation set.

Methods Documentation

get_project_translations(project_id, language=None)

Get language translations for the provided project.

Parameters
  • project_id – Identifier of the project

  • language – (Optional) language to select the translations by

Returns

A list of translations.

Example:

>>> client.get_project_translations("project_uuid1")
[
    {
        "key":":cancel",
        "en": "Cancel",
        "de": "Abbrechen",
    },
    {
        "key": ":yes",
        "en": "Yes",
        "de": "Ja",
    },
]
modify_project_translations(project_id, translations)

Update language translation set.

Parameters
  • project_id – Identifier of the project

  • translations – List of language translations

Returns

Example:

>>> client.modify_project_translations("project_uuid1",
        [{"key":"cancel","en":"Cancel","de": "Abbrechen"}]
    )
[
    {
        "key":":cancel",
        "en": "Cancel",
        "de": "Abbrechen",
    },
    {
        "key": ":yes",
        "en": "Yes",
        "de": "Ja",
    },
]
new_project_translations(project_id, translations)

Create new language translation set. Note: the existing translation set gets overwritten.

Parameters
  • project_id – Identifier of the project

  • translations – List of language translations

Returns

Example:

>>> client.new_project_translations("project_uuid1",
        [{"key":":yes","en":"Yes","de": "Ja"}]
    )
[
    {
        "key": ":yes",
        "en": "Yes",
        "de": "Ja",
    },
]