Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:adm:personalize_localization [2018/12/28 13:20]
kotisovam [Personalize localization]
tutorial:adm:personalize_localization [2022/11/28 14:27] (current)
kopro
Line 1: Line 1:
 +====== Personalize localization ======
 +
 +<WRAP center round info 60%>
 +
 +This tutorial may be obsole for newer version.
 +
 +</WRAP>\\
 +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 (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 [[https://stedolan.github.io/jq/|jq library]]. JQ is like sed for JSON data. For a debian system you can use:
 +<code>
 +
 +$ apt-get install jq
 +
 +</code>
 +
 +Set up a script permission:
 +
 +<code>
 +$ chmod +x localizationTransform.sh
 +
 +</code>
 +
 +Create file ''override_localization.txt'' at same path as script. The list files of folder czechidm-app will be like:
 +<code>
 +build.sh
 +config
 +czechidm-modules
 +dist
 +docs
 +gulpfile.babel.js
 +index.html
 +localizationTransform.sh
 +node_modules
 +override_localization.txt
 +package.json
 +src
 +
 +</code>
 +
 +===== Configuration file =====
 +
 +In file ''override_localization.txt'' is each line one override message. Structure:
 +<code>
 +<MODULE_ID>;<LOCALIZATION>;<LOCALIZATION_KEY>;<LOCALIZATION_MESSAGE>
 +
 +</code>
 +
 +  * **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:
 +
 +<code>
 +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
 +
 +</code>
 +
 +===== Script run =====
 +
 +<code>
 +$ ./lozalizationTransform.sh
 +
 +</code>
 +
 +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:
 +
 +<code>
 +FAILED key: 'content.role.nonExisting' was not found.
 +
 +</code>
 +
 +===== Example output of script =====
 +
 +<code>
 +➜  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.
 +
 +</code>
 +