Jump to content
okolaris

MultiLanguage Scite Tool + UDF

Recommended Posts

okolaris

Hey everyone,

I thought I might share my little Language UDF plus the more powerful SciTE Tool to ship Strings from SciTE into the xml file. While I haven't had the time to fully adapt the small UDF to one of the big XML-UDFs the so called "Language Transmitter" that basically writes the XML file for you runs mostly on "XML DOM wrapper (COM)" by eltorro. The Transmitter should work with other XML-Language-UDFs depending on their encoding.

 

First let's start with the UDF, there are two functions of interest: _LangInit($sFilePath) and s($sString) As you will have guessed, _LangInit($sFilePath) is called once to initialize the UDF and s($sString) is used to receive the string to your key. Plain and simple.

Now to the actual "new" part, the Language Transmitter. It basically allows you to transfer a selected String from SciTE into a xml file. While doing so it will scan for AutoIt variables, macros etc. and parse the string to fit StringFormat(). It then saves the formatted string in the xml file and returns the formatted call into SciTE. If the selected string is already defined it will directly parse the key into SciTE. To change the default output file, you can either edit the ini-file in the @ScriptDir of the LanguageTransmitter.exe or press Alt+A on empty space again and keep clicking cancel/no until the Transmitter let's you select the current output file. Standard output is strings.xml in the current opened AutoIt Script.

Example:

; given the line:
MsgBox(16, 'Error', 'Error message')
; select 'Error' run the Transmitter follow the instructions, repeat with 'Error message'. Outcome (e.g.):
MsgBox(16, s('Error'), s('Error_msg'))

; Variables and Macro example:
$sString = "Value: " & $iValue & @CRLF & 'Another value: '& $iValue2
; Select the full string including all AutoIt variables and macros etc. in SciTE and press Alt+A (default) to run the LanguageTransmitter
; follow the instructions and it will then paste a formatted string like that into SciTE:
$sVar = StringFormat(s('Key'), $iValue, $iValue2)

; the correlating xml entry should look like that:
; <string name="Key">Value: %s\r\nAnother value: %s</string>
; as you can see @CRLF has been replaced with \r\n as well.

If you are working on a project and want to directly add a string to the xml file just start the Language Transmitter without selecting any text, enter your string and a key.

SetUp/Installation

Spoiler
  1. Copy the UDF LanguageSupport.au3 in your Include folder
  2. Set up the Language Transmitter in SciTE:
    1. Go to Options -> Open au3.properties
    2. Paste the code (change the number if necessary)
# 35 okolaris's Language Transmitter
# save.before 1 = save, 2 = do not save
command.35.$(au3)=$(user.tools.path)\LanguageTransmitter.exe /in "$(FilePath)"
command.input.35.*=$(CurrentSelection)
command.subsystem.35.$(au3)=1
command.name.35.$(au3)=Language Transmitter
command.shortcut.35.$(au3)=Alt+A
command.save.before.35.$(au3)=1
command.replace.selection.35.$(au3)=1
command.quiet.35.$(au3)=1# 35 okolaris's Language Transmitter

If you have not done yet, set up a custom SciTE-Tools Folder:

open Options-> SciTEUser.properties and change or add (for example): user.tools.path=C:\MyTools

After that copy the LanguageTransmitter.exe into your SciTE Tools folder.

Examples

Since xml files are required all examples can be found in the zip file. There are two examples, one includes a language selection interface.

Language File Checker

I added a script to check whether the xml file contains all required strings or even unnecessary strings.

 

Hope you like my little helper!

 

UDF - LanguageSupport.zip

Edited by okolaris
  • Like 1

Share this post


Link to post
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

  • Similar Content

    • timmy2
      By timmy2
      To change the language used by Windows GUI and the browser (Chrome in my case), the only method I've found that works is to go to Settings > Time & Language > Language > Preferred Language, switch the default from English to Spanish, sign out, and then upon signing in everything will be in Spanish as expected.
      Besides automating the above process is there a more direct way to change Windows' settings using AutoIt?
    • MFrancisca
      By MFrancisca
      Hello! 
      I've been checking the logging UDFs in the wiki, mostly Log4a and Loga and I wanted to ask which one would you recommend for a script that will be executed remotely through PSExec. My main question is where the logs are located in that situation and if I can change that location to a custom one., because I need to retrieve them at the end of execution.
      So in a rough description the process is
      Open PSExec
      Send compiled AutoIT script to remote machine
      Execute script
      Copy logs from the remote to the local machine.
       
      Any opinions? 
    • timmy2
      By timmy2
      I've noticed in several YouTube tutorials about AutoIt that every time the instructor types EndFunc a comment "<==(function name)" is automatically added. I understand that Tidy will do this after the fact but what I'm writing about happens in real time. Where's the setting for this?  Thank you.
    • caramen
      By caramen
      I watched _OL_ItemSend&_OL_ItemFind&_OL_ItemCreate in OutlookEx UDF but hmmm
       
      Since it use the test environnement i cant get the orders of the mail creation
       
      Can someone make me win some time of reading all exemples script and lead me how to do one ?
      That whould be lovely.
      Gnight
    • ademon
      By ademon
      Hi. I can open the editor with out problems but I can not compile because it is placed on another partition diferent from C.
      Can you provide an update of this bug?


×