Personalize localization

If you want to personalize some of error, warning, info messages, labels, buttons, etc. you can use the simple shell script (for now, TODO is the script only for Linux systems).

Presently, you can download the script here (TODO script will be part of the product).

Place the script into the built-in frontend (eq. czechidm-app/dist/).

As pre-requisites you must install jq library. JQ is like sed for JSON data. For a debian system you can use:

$ apt-get install jq

Set up a script permission:

$ chmod +x localizationTransform.sh

Create file override_localization.txt at same path as script. The list files of folder czechidm-app will be like:

build.sh
config
czechidm-modules
dist
docs
gulpfile.babel.js
index.html
localizationTransform.sh
node_modules
override_localization.txt
package.json
src

In file override_localization.txt is each line one override message. Structure:

<MODULE_ID>;<LOCALIZATION>;<LOCALIZATION_KEY>;<LOCALIZATION_MESSAGE>
  • MODULE_ID: id of module (core, acc, reg, pwdreset),
  • LOCALIZATION: localization :) (cs, en),
  • LOCALIZATION KEY: key of override message,
  • LOCALIZATION MESSAGE: new localization message

Examples:

core;en;app.name;New CzechIdM
core;cs;app.name;Nové CzechIdM
core;en;entity.Role.name;New role name
core;cs;entity.Role.name;Nové jméno role
acc;cs;content.system.detail.header;New connected system
acc;en;content.system.detail.header;Nový napojený systém
$ ./lozalizationTransform.sh

On running the script, you get a message displaying the standard output. If some localization key will not be found though, you will receive an error message pointing out the reason for failure:

FAILED key: 'content.role.nonExisting' was not found.
➜  dist ./lozalizationTransform.sh 
     ____              _       ___    _ __  __ 
    / ___|_______  ___| |__   |_ _|__| |  \/  |
   | |   |_  / _ \/ __| '_ \   | |/ _' | |\/| |
   | |___ / /  __/ (__| | | |  | | (_| | |  | |
    \____/___\___|\___|_| |_| |___\__,_|_|  |_|
 ___  _____   __          _      _   _             
| _ )/ __\ \ / /  ___ ___| |_  _| |_(_)___ _ _  ___
| _ \ (__ \ V /  (_-</ _ \ | || |  _| / _ \ ' \(_-<
|___/\___| \_/   /__/\___/_|\_,_|\__|_\___/_||_/__/
Script for transfrom lozalization message from build FE project

JQ installed.
Replace: 'app.name', language: 'cs', module: 'core', new localization: 'Test'
Replace: 'app.name', language: 'cs', module: 'core', new localization: 'Test'
Replace: 'entity.Role.name', language: 'cs', module: 'core', new localization: 'new role name'
Replace: 'entity.Role.name', language: 'en', module: 'core', new localization: 'new role name'
FAILED key: 'entity.Role.test' was not found.
FAILED key: 'entity.Role.test.' was not found.

Localization translation was ended.