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:
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.