Editing a Language

89 vues Markdown

Manage a language's order, default role, and all shared texts in one place to keep the panel, website, and notifications linguistically consistent.

Reaching the Screen

Open Languages then Browse Languages, and click the language you want (or use Edit in its row menu): {admin}/languages/edit?key={language}

The key in the address is the language's own short code, the one printed next to its title in the list and the one that appears in your site's addresses.

What Is on the Screen

A single form. The upper rows are the language's own record and are saved together; the last row is a panel of text tools that act on their own.

Language record Title, writing direction, sort order and the default flag. These are saved together with the button at the bottom of the form.
Language Texts Export, load and restore controls for the texts the language pack itself carries. They run the moment you confirm them and do not wait for the save button.
No delete action Languages ship with WISECP and cannot be created or removed from the panel. A language you do not want to offer is switched off instead, which is reversible.

Language Texts

This panel is a round trip. You export the texts the language pack carries under coremio/locale as one JSON file, edit the wording offline, and load the same file back. The keys, the nesting and the variables come back exactly as they left, which is what makes a bulk edit safe to repeat.

It is the language pack, not everything a language touches. Routing, package and SMS settings files are left out because they carry addresses and settings rather than wording, and rewriting them would break the screens instead of rephrasing them. A few files that do carry wording are also left out because they have a screen of their own: the home page blocks belong to the theme settings, and the site constants to the general settings. Module texts, theme texts and the notification templates stay outside the round trip as well.

Every file a load rewrites is copied first, so a bulk edit always has a way back. Two kinds of copy sit side by side under coremio/storage/language-backups: the state before the very first load ever ran, and the state just before each individual load.

What the Load Refuses

A load is a wording change, never a structural one. Four things are counted and skipped rather than written, and the message after the load tells you how many of each there were.

A key the language does not have Texts are matched by key. A key that is not already in the file is skipped and never created, because nothing would read it.
A changed variable A value that dropped or renamed a variable such as {name} is skipped. Kept as it is, the screen would print the braces instead of the customer's name.
Changed HTML tags A value that lost a <strong> or gained an unclosed tag is skipped for the same reason: it would break the layout that renders it.
A file that is not part of the pack Only the files a language pack actually ships are read. A renamed or foreign path is skipped without ever reaching the disk.

Fields

Status Whether the language is offered to your customers. The box is locked for the default language, which cannot be taken off the site. This setting is not saved from this form: the switch in the language list is what turns a language on and off.
Language Title Read only here. It is the title visitors see when they pick a language, and it comes with the language pack.
Default Language Off unless this language already holds the role, in which case the box is locked. Ticking it and saving moves the default here.
RTL Not editable here. It marks a right to left language and comes with the language pack, because the flag turns around the layout of every page shown in that language.
Sort Order Sets where the language sits among the others, both in the panel's list and in the picker your visitors use.
Load JSON Takes a .json file exported from this same screen, up to 20 MB. Choosing a file changes nothing on its own: Apply stays closed until one is chosen, and the load runs only after you confirm it.

Tasks

Make this the default language

  1. Tick Default Language. The box is locked when this language already is the default.
  2. Save. The role moves here: this language's addresses drop the language code, the previous default starts carrying its own, and this language can no longer be switched off.

Change where the language is listed

  1. Type a number in Sort Order.
  2. Save. The language takes its new place in the language list and in the picker your visitors see.

Edit the texts in bulk

  1. Use Export as JSON. The downloaded file holds the texts the language pack carries, grouped by the file each one lives in.
  2. Change only the wording. Leave the keys, the variables such as {name} and the HTML tags exactly as they are.
  3. Use Load JSON, pick the edited file, then Apply and confirm.
  4. The screen reloads and reports how many texts and files changed, what was left untouched, and where the previous version was kept.

Undo a bulk edit

  1. Use Restore Defaults. The button is closed until this language has been loaded into at least once, because until then it is already in its default state.
  2. Confirm. Every text goes back to the wording the language shipped with, the version being replaced is kept as a backup first, and the screen reloads with the number of files restored.

Things to Watch

Changing the default language changes your addresses

The default language is the one served without a language code in the address; every other language carries one. Moving the role therefore rewrites which addresses your visitors and search engines see, on both languages at once. Decide it early rather than after the site has been indexed.

A loaded file reaches every screen at once

These texts are shared: one line can appear in the panel, on the site and in an e-mail. The load protects the structure for you by skipping anything whose keys, variables or tags changed, but it cannot judge the wording. A future update may also replace what you loaded, so keep your edited file.

Restore Defaults goes back to the beginning

It returns to the state before the first load ever ran, not to the load before the last one, so a series of edits comes off in one step. It is reversible in turn: the version it replaces is copied under coremio/storage/language-backups before anything is written.

Required Privileges

The language section opens for staff holding LANGUAGES_LOOK or LANGUAGES_OPERATION. This screen itself needs LANGUAGES_OPERATION: opening its address without it returns the language list instead. Saving, exporting, loading a file and restoring defaults all run under that same permission.

Cet article vous a-t-il été utile ?

Merci pour votre retour !

Besoin d'aide supplémentaire ?

Notre équipe d'assistance est disponible 24h/24 pour tout ce que vous ne trouvez pas ci-dessus.