Locale Builder

Dutch eric redegeld 2 days ago

LocaleBuilder for OSSN

LocaleBuilder is an OSSN admin component that helps create and update language files for installed OSSN components.

It scans all component folders for:

locale/ossn.en.php

and can generate translated files such as:

ossn.nl.php
ossn.de.php
ossn.fr.php
ossn.es.php

The component keeps all original language keys unchanged and checks placeholders like:

%s
%d
%1$s

so translated files do not break OSSN forms, emails or notifications.

How it works

From the OSSN admin panel, go to:

Administrator > Components > LocaleBuilder

You can:

scan installed components
select one or more components
select target languages
generate missing locale files
overwrite existing locale files
create backups before overwriting
use queue mode for multiple translations

For AI translation, LocaleBuilder processes one component and one language per task. This prevents Apache or PHP timeouts on larger OSSN installations.

Queue mode

Queue mode is useful when you want to translate many components.

Steps:

  1. Select multiple components
  2. Select one or more target languages
  3. Enable AI translation
  4. Click Create queue
  5. Click Process next task until the queue is empty

Each queue task translates one component into one language.

OpenAI API key

LocaleBuilder can use the OpenAI API for better translations.

Each installation must use its own OpenAI API key. The key can be created in the OpenAI Platform dashboard under API keys. OpenAI provides API docs, model information and pricing through the developer platform and pricing pages.

In LocaleBuilder, enter the key in:

AI translation settings > OpenAI API key

Then click:

Save and test API

If the test succeeds, AI translation can be used.

Where the API key is stored

LocaleBuilder stores the API settings outside the component folder, in the OSSN data directory when possible.

Example location:

ossn_data/components/LocaleBuilder/settings.json

This means the API key is not stored inside the public component files and should not be included when sharing the component on GitHub.

Advanced users can also define the key in a PHP config file:

define('LOCALEBUILDER_OPENAI_API_KEY', 'your-api-key-here');
Costs

Translation uses only small text strings from OSSN language files. In most cases, token usage is very low, so the cost per component translation is usually minimal. Actual costs depend on the selected OpenAI model, number of strings and current OpenAI pricing.

Comments

Component

Developer: eric
License gpl3
Type: Site admin
Requires OSSN Version : 8.0
Latest Version:
Last Updated
Repository Url View Repository

Versions