Lokalize - Manage translation strings for your app in Cockpit

Lokalize

Manage translation strings for your app in Cockpit

Configuration

Configuration config/config.yaml:

lokalize:
    importkeys: false,
    publicAccess: false,
    translationService:
        provider: Google // or Yandex
        apikey: AIzaxxx

Api

Get localized strings of a project:

/api/lokalize/project/{name}?token=*apitoken*

Get strings for a specific language

/api/lokalize/project/{name}/{local}?token=*apitoken*
2 Likes

This is a pretty neat addon !

I’ve already found a usage on a multi-language Wordpress website. It’s easier and more elegant to translate forms made with Gravity Forms with Lokalize translation strings than with the clumsy WPML plugin.

It’s also easy to add a new language by just adding an element in the $languages array in bootstrap.php and a svg flag in assets/media/flags/.

I don’t know if the forum is the place for a feature request, but it would be interesting to have events on Lokalize (like for collection, singleton, forms), just to be able to plug webhooks on some Lokalize events.

Real case usage: I’ve got a php script on a website that calls a distant cockpit API to retrieve translation strings and store them as json files on local filesystem (I don’t want to call API at every page load). A webhook on the modification of a Lokalize object would just call this script and keep the local json files up-to-date.

Thanks.

FYI: there is now a lokalize.saveproject event triggered

Oh great. I’ll test it out.
Thanks.

I may be out of the technically out of the loop, but how you’re supposed to install it? Can’t find any instruction anywhere.

It’s actually pretty easy! Check this article: https://zeraton.gitlab.io/cockpit-docs/guide/addons/#installation