- 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.
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.
- Flask Blueprints
- 深入淺出WPF
- OpenCV for Secret Agents
- Python王者歸來
- Redis Essentials
- 數(shù)據(jù)結(jié)構(gòu)案例教程(C/C++版)
- ANSYS Fluent 二次開發(fā)指南
- Java網(wǎng)絡(luò)編程核心技術(shù)詳解(視頻微課版)
- 精通MySQL 8(視頻教學(xué)版)
- 創(chuàng)意UI:Photoshop玩轉(zhuǎn)APP設(shè)計
- Python大規(guī)模機器學(xué)習(xí)
- Instant Pygame for Python Game Development How-to
- Visual FoxPro程序設(shè)計習(xí)題及實驗指導(dǎo)
- Python人工智能項目實戰(zhàn)
- Java EE 程序設(shè)計