How to change "language code" from "tw" to "hk and solve the language translation with empty content error? <complete and workaround solution>
You need to import TW Traditional Chinese first. The finish setting is just as same as above screenshot.
In the Localization->Languages
ISO Code: tw -> hk
Language code: zh-tw -> zh-hk
<<it is a workaround solution>>
If you are afraid of touching code, you can follow below workaround solution.
Just keep the setting as tw and zh-tw in language setting. Go to finish your translation first. After the translation is done, go to change to above setting hk and zh-hk
<<It is a complete solution>>
In the backend, you just need to follow the below instruction.
edit the below file by nano or vi editor
yourprestashopfolder/app/Resources/legacy-to-standard-locales.json
add below code into line 33
"hk": "zh-HK",
<copy whole folder from zh-TW to zh-HK>
if your Prestashop is 8.0, the "translations" folder will be "yourprestashopfolder/translations/".
cp -r yourprestashopfolder/app/Resources/translations/zh-TW yourprestashopfolder/app/Resources/translations/zh-HK
if your file/folder permission is changed, you need to use chmod to change it accordingly.
<change to target folder>
cd zh-HK
<replace all file name from *.zh-TW.xlf to zh-HK.xlf>
find . -name "*.zh-TW.xlf" -exec sh -c 'f="{}"; mv -- "$f" "${f%.zh-TW.xlf}.zh-HK.xlf"' \;
<replace the zh-TW to zh-HK in all .xlf files>
find . -type f -exec sed -i 's/zh-TW/zh-HK/g' {} \;
<add HK language in the below json file>
/opt/lampp/htdocs/riise/app/Resources/all_languages.json
add the following after tw