官术网_书友最值得收藏!

  • Bash Cookbook
  • Ron Brash Ganesh Naik
  • 315字
  • 2021-07-23 19:17:38

Readying your script for different languages with internationalization

Great, so you have this awesome script, but it's written in standard English and you would like to target those nice people who speak other languages. In some countries like Canada, they (we) have two official languages: English and French. Sometimes, the dual-language component is enforced with legislature and localized language laws. 

To get around this, let's imagine a scenario where you are an individual who has written a script that prints out specific strings, but in English first. He/she wishes to have all of the strings inside of variables so that they can be swapped in and out dynamically using system language variables. Here are the basics:

  • Create a shell script that utilizes gettext and sets the appropriate variables
  • Build a po file that contains the necessary language definitions
  • Install your output language localization file for your script
  • Run your script with a language that's different than the one you originally use (by setting the LANG variable)

Before getting started, though, there are two terms that need to be discussed: internationalization (i18n) and localization (L10n). Internationalization is a process that enables translation and localisation/adaptation for a specific script or program, and localization refers to the process of having adapted the program/application for a specific culture.

The translation of scripts from the start can be an effective way to save time and improve the success of multi-lingual efforts. However, be aware that it can be a time-consuming process if the developers are fluent in only one language, or translation skills are not immediately present.

For example, in English, there are several dialects. In the USA, a product of a process or leftover can be called an artifact, but in Canadian English, it may be called an artefact. It could go unnoticed (or ignored), but the program could automatically adapt with specific localization.

主站蜘蛛池模板: 武安市| 宕昌县| 鄱阳县| 烟台市| 宁阳县| 基隆市| 陆丰市| 苏尼特右旗| 平乐县| 西城区| 阿坝县| 鄂尔多斯市| 禄丰县| 台北县| 保定市| 广东省| 神木县| 元氏县| 五河县| 潜江市| 华宁县| 比如县| 天等县| 洮南市| 肇州县| 启东市| 灵丘县| 香港 | 泰安市| 双鸭山市| 宜春市| 诸暨市| 阿拉善右旗| 融水| 清水河县| 常熟市| 涿鹿县| 沈丘县| 大洼县| 太谷县| 稻城县|