Translation - rejetto/hfs GitHub Wiki

The instructions below describe the stable release. For the upcoming translation-management changes in HFS 3.4 beta, see HFS 3.4 beta.

If your language is still not included, download the English file as a starting point. Rename the file by changing the "en" part with your language's 2-letter code (use the 2+2 letter format only when necessary). E.g.: hfs-lang-de.json for German, hfs-lang-pt-br.json for Brazilian Portuguese.

Now you can translate in your language each line after the "translate" line, but just the parts after the :.

The file is a text file with JSON syntax, and each sentence syntax is ICU. When you see curly braces like {n}, that’s a variable, like a number, always changing. Commands within curly braces MUST NOT be translated, like plural. Also one and other are commands, so don't translate them!

The way plural works in your language is probably different from english, so if you don't get the results you need, you may need to make some changes. Refer to this guide to know your options.

Always check that your file works well on your computer before submitting. If you see bad characters, verify your file is saved as UTF8. When you are sure it's good, you can publish it. The easiest way is to open an issue and attach your file (you may need to zip it, first, or rename it to .txt because github is not allowing .json). We will include it in our folder.

Follow this thread to keep updated about new strings.

Suggestion

Use chatGPT or anything similar, and enter: translate to vietnamese (or whatever your language is) and then paste the whole JSON. You will get a better starting point, save a lot of time, avoid confusion with the {n} syntax.

If you cannot access chatGPT or a similar tool, ask on the forum and we'll do it for you. Just specify the target language.

Customization

If you need to make some changes to the existing translation, your options are

  • option A: make your own translation
  • option B:
    • you add some javascript to modify the language, by (making a plugin or) adding a tag to Admin-panel > Custom HTML > Section "After header"
      <script>
      // "it" in the next line is for "italian", you need to change it to your language code
      HFS._.merge(HFS.lang, { it: { translate: {
        Username: "Ciao",
        Password: "Bye",
      } } })
      </script>

HFS 3.4 beta

This section describes translation management for the upcoming HFS 3.4 release, currently in beta. The Admin translation upload workflow is under development and may not be available in your beta build yet. It does not apply to the stable 3.3 release.

Frontend and Admin translations

HFS 3.4 has separate translations for the frontend (the file-browsing interface used by visitors) and the Admin panel.

In Admin-panel → Language, the two language selectors work independently. Each can use a specific language or respect the browser's language. Built-in languages are already available in these selectors; you do not need to upload them.

The Uploaded languages table lists only files you have uploaded. Its Interface column identifies each file as Frontend or Admin.

Preparing a file

Start with the appropriate English file from the 3.4 development branch, or with an existing translation for the same interface:

Interface English template Filename example for Italian
Frontend hfs-lang-en.json hfs-lang-it.json
Admin hfs-admin-lang-en.json hfs-admin-lang-it.json

Replace en with your language code, such as it, de, or pt-br. Keep the rest of the filename: HFS uses the hfs-admin-lang- prefix to recognize an Admin translation. Renaming a frontend file does not convert it into an Admin translation; the two interfaces use different text entries.

Save the file as UTF-8 JSON. Translate the values inside the translate object, keeping the keys, placeholders, and ICU commands unchanged. The optional author and version fields describe your translation. To customize a built-in language, start with its complete translation file and edit the entries you need.

Uploading and selecting a translation

  1. Open Admin-panel → Language.
  2. Click the upload icon (Add) in the table header and choose one or more JSON files. Frontend and Admin files can be uploaded together.
  3. Select the language in the corresponding Frontend language or Admin language selector, or leave it on Respect browser language.

New language codes are supported. After an Admin upload, the page reloads to refresh its translations and available languages.

Uploading another file for the same interface and language replaces your previous upload. Frontend and Admin files with the same language code remain independent.

Use the row's delete button to remove an uploaded file. If HFS includes a built-in translation for that interface and language, it becomes available again. Built-in translations cannot be deleted. If a selected custom Admin language no longer exists, the Admin panel falls back to browser language selection, then English.

⚠️ **GitHub.com Fallback** ⚠️