Jump to content


Recommended Posts

I needed to create a simple i18n library for an open-source project I've worked on last week.

So I made this simple and easy to use.

When translating, you have two options: the first one is to use a global file on the following format:

text_with_format=Number: %.2f
text_with_parameter=Hi %s


The second option is to separate every translation into files named language_code.lng in a folder of your choice. Note that every file on this folder will have the following format:

text_with_format=Number: %.2f
text_with_parameter=Hi %s

The language code can be ISO 639-1 (2 chars, like "en", "pt", "es") or culture code (including the country, like "en-US", "pt-BR", "es-ES"). You can use both these formats on the same file/project without any problem.

Finally, use the _() function to get your translation text. It accepts the following syntax:

_($sText_id [, $sPar1 [, $sParn ] ] )

The parameters are optional, but the maximum number of parameters is 32. If you need more than 32 parameters (sure?), please consider splitting your string into multiple ones.

Note that everything is explained on the Example.au3 (see online) and Example.lng (see online) file.

Interesting note (source):

I18n - Internationalization - Providing some kind of framework so that you can easily swap out strings, graphics, sounds and other resources and generally handling different conventions of communication.

L10n - Localization - The process of creating a bunch of strings, graphics, sounds etc. so that you can target a specific nationality, language or region.

G11n - Globalization - Doing both Internationalization and Localization steps


Download: AutoIt Files

Fork me on Github

Edited by Jefrey

My stuff


My UDFs  _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS ·  storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...