- 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.
- Learn ECMAScript(Second Edition)
- Oracle Exadata性能優(yōu)化
- C#完全自學(xué)教程
- Visual Basic編程:從基礎(chǔ)到實(shí)踐(第2版)
- Kotlin編程實(shí)戰(zhàn):創(chuàng)建優(yōu)雅、富于表現(xiàn)力和高性能的JVM與Android應(yīng)用程序
- ASP.NET Core 2 Fundamentals
- Unity 3D腳本編程:使用C#語言開發(fā)跨平臺游戲
- Vue.js應(yīng)用測試
- C編程技巧:117個(gè)問題解決方案示例
- Python預(yù)測之美:數(shù)據(jù)分析與算法實(shí)戰(zhàn)(雙色)
- Java語言程序設(shè)計(jì)實(shí)用教程(第2版)
- Spring Boot從入門到實(shí)戰(zhàn)
- Managing Windows Servers with Chef
- 分布式系統(tǒng)架構(gòu)與開發(fā):技術(shù)原理與面試題解析
- SAP HANA Starter