Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: thinternationnal

  1. #1

    Lightbulb thinternationnal

    Hi,

    I wrote a tiny tool to help i18n usage.
    There is left one adjustment for it to start working :
    I18N.GetText seems to not accept key="some key with spaces" although it is valid xml.

    All comments welcome.

    thinternationnal.zip
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Sebastian,

    I checked the sources and a looot of work went into this effort.

    Maybe you could explain more in your first post what is the goal of the tool, please?
    I think it will inspire others to try it

    I must admit I am not sure if I use the tool correctly at the moment, however, I found out:
    - TestFile2.tbasic contains redundant NEXT
    - if you want one file get included just once, you can use #include once
    - you could aid installation of the tool like:

    ' Save as install.py where README.txt is
    uses "file", "ini", "console"
    
    
    string toolsDir = APP_Path + "thinAir\Tools\"
    
    
    print "Installing binary..."
    string newBinary = InstallToolBinary(toolsDir)
    if FILE_Exists(newBinary) Then
      printl "OK" in 10
    else
      printl "Failed" in 12
      waitkey
    end if
    
    
    RegisterToolBinary(toolsDir)
    
    
    printl "Installation finished, restart thinAir please!" in 14
    waitkey
    
    
    function InstallToolBinary(toolsDir as string) as string
      string newToolDir = toolsDir + "thinternational\"
      dir_make(newToolDir)
      string fullDestPath = newToolDir + "I18N.exe"
      file_copy("bin\I18N.exe", fullDestPath)
      
      return fullDestPath
    end function
    
    
    function RegisterToolBinary(toolsDir as string)
      string toolsConfigFile = toolsDir + "thinAir_Tools.ini"
      
      ini_setKey(toolsConfigFile, "thinI18N", "Menu", "thinternational")
      ini_setKey(toolsConfigFile, "thinI18N", "CommandLine", "%thinAirinstallpath%\Tools\thinternational\I18N.exe ""%sourcecodefullpathname%""")
      ini_setKey(toolsConfigFile, "thinI18N", "SaveScriptBefore", "true")
    end function
    

    Petr
    Last edited by Petr Schreiber; 18-11-2019 at 22:53.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    Hi Petr,

    Thanks for the install script. It's too soon for this tool but will definitely be of use some day.

    About TestFile2.tbasicu , it's just here to provide a sample text to parse for the tool to create the XML file. And, I can't find this redundant NEXT.

    The tool itself: it generates the translation xml file by parsing the code. But, I can't get the I18N module to read keys that contains spaces.


    Quote Originally Posted by Petr Schreiber View Post
    Hi Sebastian,

    I must admit I am not sure if I use the tool correctly, however, I found out:
    - TestFile2.tbasic contains redundant NEXT
    - if you want one file get included just once, you can use #include once
    - you could aid installation of the tool like:

    ' Save as install.py where README.txt is
    uses "file", "ini", "console"
    
    
    string toolsDir = APP_Path + "thinAir\Tools\"
    
    
    print "Installing binary..."
    string newBinary = InstallToolBinary(toolsDir)
    if FILE_Exists(newBinary) Then
      printl "OK" in 10
    else
      printl "Failed" in 12
      waitkey
    end if
    
    
    RegisterToolBinary(toolsDir)
    
    
    printl "Installation finished, restart thinAir please!" in 14
    waitkey
    
    
    function InstallToolBinary(toolsDir as string) as string
      string newToolDir = toolsDir + "thinternational\"
      dir_make(newToolDir)
      string fullDestPath = newToolDir + "I18N.exe"
      file_copy("bin\I18N.exe", fullDestPath)
      
      return fullDestPath
    end function
    
    
    function RegisterToolBinary(toolsDir as string)
      string toolsConfigFile = toolsDir + "thinAir_Tools.ini"
      
      ini_setKey(toolsConfigFile, "thinI18N", "Menu", "thinternational")
      ini_setKey(toolsConfigFile, "thinI18N", "CommandLine", "%thinAirinstallpath%\Tools\thinternational\I18N.exe ""%sourcecodefullpathname%""")
      ini_setKey(toolsConfigFile, "thinI18N", "SaveScriptBefore", "true")
    end function
    

    Petr
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    One more tip - the thinTool does not have to be binary!

    You can keep just the script and in the INI file use thinBASIC to launch it. I think it is better practice, because users can check it does not do anything... bad


    Petr

    P.S. I will consider to convert thinClippy to be tool with visible source as well
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5
    Hi,

    Quote Originally Posted by Petr Schreiber View Post
    One more tip - the thinTool does not have to be binary!

    You can keep just the script and in the INI file use thinBASIC to launch it. I think it is better practice, because users can check it does not do anything... bad


    Petr

    P.S. I will consider to convert thinClippy to be tool with visible source as well
    • How does your command look like in thinAir_Tools.ini ? I can't get the script running without bundling.
    • Then, there is something weird :
      if I enclose %sourcecodefullpathname% with double quotes (like this : "%sourcecodefullpathname%" ),
      and then check the parameter with File_exists, I get always a %False result (although the path is correct).
      But if I didn't enclose it with double quotes, I get %True when there is no space in path,
      and path with spaces won't work (normal).
      Any Idea why File_exists return %False ?
    • "Maybe you could explain more in your first post what is the goal of the tool, please?" Petr, I can't edit the first post any more (like you do with BTB). I would have it done otherwise.
      I updated the readme.txt
    • New version, functional this time : thinternationnal (beta).zip

    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  6. #6

    Question

    Hi,

    Eros , I18N.Gettext() do trim$ the text. Can you tell how I can avoid that ?
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  7. #7

    Thumbs up

    Latest version of thinternational can be found here : https://github.com/DirectuX/thinternational
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    This project has great potential to help a lot of people here with internationalization.

    I just wonder how to make the setup/use more "plug and play".


    Thank you for your work,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  9. #9

    Thumbs up

    Quote Originally Posted by Petr Schreiber View Post
    I just wonder how to make the setup/use more "plug and play".
    Quite simple : ask Eros to include it in the distribution.

    but: I still didn't found how you do to run scripts from the user tool menu , it didn't work here: i have to bundle it for that.
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    I got it working. Minimal example follows:

    - save this as "hello.tbasic" in "thinBasic\thinAir\Tools\MyScript"
    uses "os"
    
    
    msgbox 0, "I process " + OS_GetCommand(2)
    
    - edit the "thinAir_Tools.ini" with this:
    [MyScript]
    Menu=MyScript
    CommandLine=%thinbasicinstallpath%\thinbasicc.exe "%thinAirinstallpath%\Tools\MyScript\hello.tbasic" %sourcecodefullpathnameext%
    SaveScriptBefore=true
    
    After you restart thinAir, it should launch the script which is aware of the file.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 1 of 2 12 LastLast

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •