Search the Community
Showing results for tags 'i18n'.
-
AU3Text.au3 v1.0 An extensive UDF to ease the internationalization of AutoIt scripts and programs. Add multi-lingual support to your scripts and programs in a consistent and portable manner. Main features: Store messages in a human-readable INI format.Organize messages in different categories.Handle singular and plural string variants at run time.Expands meta-characters and all AutoIt macro's.Supports UTF-16 Little-Endian encoding.GUI Menu and Combo Create/Read helper functions.Command line utility to extract messages from AutoIt scripts.Fully portable!The download contains the following files:ReadMe.txt Instructions and information on the UDF. AU3Text-HowTo.txt Step by step instructions to convert programs for internationalization with AutoIt. AU3Text-Demo.au3 AU3Text demo. AU3Text-Extractor.au3 Source file for command line utility to extract AU3Text messages from scripts. You'll need to compile this script before you can use it. This is BETA software! LibAU3Text.au3 Main AU3Text library. LibAU3TextGUI.au3 AU3Text GUI helpers. LibAU3TextDev.au3 Additional developer functions. LibLocale.au3 Locale functions. Originally based on guinness' excellent _GetOSLanguage function, but has grown into a full stand-alone UDF. LibIni.au3 UTF-16 LE INI functions. LibStringFormatEx.au3 Modified StringFormat function. See http://www.autoitscript.com/forum/topic/139260-autoit-snippets/page__st__60#entry1010824 I18nAU3Text-Demo.en.lng English demo language file. I18nAU3Text-Demo.nl.lng Dutch demo language file. I18nAU3Text-Translation-HowTo.txt Basic translation instructions. ResAU3Text-Extractor.ico Pic unrelated :)A simple example of translating a string: #include 'LibAU3Text.au3' _AU3Text_BindTextSection('MESSAGES', 'nl') ; Set translations to dutch. ; ... Create a GUI. ; Translate a string: GUICtrlCreateLabel(_AU3Text('The flying dutchman flies again.', 'FLYING_DUTCHMAN'), -1, -1) ; De vliegende hollander vliegt alweer. ; Translate a string with plural variants: GUICtrlCreateLabel(StringFormat(_AU3Text_Plural('Deleted %i file.', 2, 'DELETED_FILES'), 2), -1, -1) ; 2 bestanden verwijdert. ; Using shorthand functions: GUICtrlCreateLabel(_('The flying dutchman flies again.', 'FLYING_DUTCHMAN'), -1, -1) GUICtrlCreateLabel(StringFormat(_P('Deleted %i file.', 2, 'DELETED_FILES'), 2), -1, -1) ; Let AU3Text generate the INI keys, keys are MD5 hashes of the messages. GUICtrlCreateLabel(_('The flying dutchman flies again.'), -1, -1) GUICtrlCreateLabel(StringFormat(_P('Deleted %i file.', 2), 2), -1, -1) ; ...The UDF: AU3Text.zip If you encounter any bugs or have any suggestions, requests or improvements, then please let me know. Happy coding! edit 1: zip added edit 2: If you compiled AU3Text-Extractor and want to test it, run it against AU3Text-Demo like this: AU3Text-Extractor.exe Au3Text-Demo.au3 beThis will create AU3Text-Demo.be.lng in the I18n directory.
- 14 replies
-
- internationalization
- i18n
-
(and 6 more)
Tagged with:
-
While developing an AutoIt-based application for an international christian organization, the need came up to provide this application for users of different native languages. So MsgBox(64, "App Title", "Please reboot your computer to complete the process.") is no longer good enough. The application needs to present its user interface in a different language, depending on the user’s preference. Of course there are many approaches to implement this. But however you do it, you will need two different toolkits: one for the translator and one for the programmer. The programmer will need something to define the translatable strings or, preferably, extract them from the source code. The translator will need something to edit the translation. The programmer will need something to incorporate the translation in to the program. And all of this should be repeatable with little effort when a few strings in the program change – don’t make the translator retranslate everything if you just add two strings for a new little feature of your program. To avoid reinventing the wheel, I decided to go the route many large open source projects go: gettext. So I've built a small toolkit utilizing the style and some tools of GNU gettext to create AutoIt applications that can be translated into any language by just adding a corresponding [language].po file. I've explained the reasoning and overview in https://martinstutenglish.wordpress.com/2016/06/10/internationalizing-autoit-applications-by-something-similar-to-gnu-gettext/ Technical details and downloadable files, including a very small example application, are in https://github.com/martinstut/gettext_au3 (updated as I improve the toolkit), most of which is also contained in the attached ZIP file. Hopefully this helps you to internationalize your own applications. gettext_au3-20160617.zip
-
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: [language_code] text_id=Translation text_with_format=Number: %.2f text_with_parameter=Hi %s [another_language_code] text_id=Tradução ... 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: [language_code] text_id=Translation 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): Download: AutoIt Files Fork me on Github