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
Last revision Both sides next revision
tutorial:adm:personalize_localization [2018/04/20 10:50]
kopro add prerequisites
tutorial:adm:personalize_localization [2018/12/28 13:31]
kotisovam [Script run]
Line 1: Line 1:
 +====== 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 [[http://up.xyxy.cz/f.php?h=3mcRC8p0&d=1|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 [[https://stedolan.github.io/jq/|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:
 +
 +<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:
 +
 +  <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:
 +<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 =====
 +  $ ./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.
 +
 +===== 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>
  • by kopro