Languages
Bengali out of the box, translate-on-the-way-out, the translation editor, collecting phrases, CSV import and export, and adding a language.
BoxPuff is written in English and ships with a complete Bengali (বাংলা) translation of the public site, the file manager and the admin panel. Any other language can be added from the panel, phrase by phrase or with a CSV file, without touching a single template.
How translation works
A language is one JSON file in languages/: its name, whether it is written right to left, whether it is offered, and the phrases it changes. Phrases in the code go through __('Sign in'); whole pages go through the translate-on-the-way-out filter, which replaces every known phrase in the finished HTML just before it is sent. Nothing has to be translated for the site to work: a phrase nobody has translated yet is shown in English, so a half-finished language still reads properly. Zones marked translate="no" (file names, codes, addresses) are left alone, and numbers inside phrases are kept.
Two files may exist for one language: <code>.dist.json is the script's own copy and comes fresh with every update; <code>.json is your site's, written by the panel. The site's file wins phrase by phrase, so your corrections survive updates. Bengali ships as languages/bn.dist.json; _phrases.json is the list of English phrases the site has met.
Choosing the language
- Site language (Site Settings → Language, also asked by the installer): the default for everyone.
- Visitors may pick a language shows the picker in the header and the footer; the choice is kept in a cookie for a year.
- Members choose their language adds a Language field under Settings → Account; a signed-in member's choice wins.
- A right-to-left language (Arabic, say) flips the layout and loads
assets/css/rtl.css.
The admin panel follows the same choice, and the file manager's own phrases (buttons, menus, dialogs) are translated through the dictionary as well.
Admin → Configuration → Languages
The page Manage Languages lists every language with its name, code, how many phrases are translated out of all known phrases, whether it is the Default, whether it is Available to visitors, its Direction, and the badge ships with BoxPuff for a .dist.json file. Buttons: Edit, Export, Make default, toggle available, Delete (not the default, not English).
Top buttons: Add Language, Scan For Missing Translations (reads every PHP, JS and template file and collects the English phrases, so a new language starts with the whole list) and Rebuild Translation Cache (after editing a file by hand).
The translation editor
Click a language: Translations: (language name) at /admin/translation-manage/<code>. A table of English and Translation, 100 phrases a page, with a search box and a Show filter (All phrases, Missing only, Translated only), the Language name and Right to left fields, and Save Translations. Long phrases get a textarea. An empty translation deletes the phrase from the file so the English shows again. The header counts N / M phrases translated.
Collecting phrases
Switch on Site Settings → Language → Collect phrases, browse the site and the panel as a visitor and a member, and every phrase that was shown is remembered in languages/_phrases.json. Switch it off when done - it writes a file on every page view.
CSV import and export
Export CSV on a language's page (or Export on the list) downloads boxpuff-<code>.csv with two columns, Source and Translation, UTF-8 with a BOM so Excel opens it correctly. Give it to a translator, then Import Translations on the list page: pick the Import Language, the Translations CSV, and leave Do not replace phrases already translated ticked to keep what you corrected by hand. The exported English file is the complete phrase list.
Adding a language
- Add Language: Code (two letters, e.g.
hi,ar,pt-br), Name as shown in the picker (e.g. हिन्दी), Right to left. - Press Scan For Missing Translations so the new language has every phrase to fill.
- Translate in the editor, or export, translate the CSV and import it.
- Set Available to Yes and, if you like, Make default.
The file lands in languages/<code>.json; copy it to another BoxPuff site and it works there too.
Bengali out of the box
Choose বাংলা (Bengali) in the installer, or Make default on the Languages page. Everything a Bengali member meets is translated: the home page, registration and sign-in, the file manager with its menus and dialogs, the download pages, e-mails' subjects and bodies where phrases are used, and the admin panel. Bengali text uses the Hind Siliguri font that the site loads with Inter. Edit any phrase you would word differently; your bn.json sits beside the shipped bn.dist.json and wins.
What is not translated
Content you typed yourself - page bodies, FAQ answers, package feature lines, e-mail templates, advertisement HTML - is shown as typed. Write those in your site's main language, or keep the phrases short and add them to the dictionary so the filter can replace them. File names, usernames and addresses are never touched.
Tips
- Translate Missing only first; the filter shows the phrases visitors actually met when Collect phrases was on.
- Keep
{name}-style holes exactly as in the English:Hello {name}becomesহ্যালো {name}. - After uploading a language file by FTP press Rebuild Translation Cache.