Jump to content
nos.17

SC4LTEXTT - SC4 LTEXT Translator

15 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

SC4LTEXT Translator is an assistant for translating SimCity 4 LTEXT files.

ProductImage.png

To use, select a DBPF file housing the LTEXT files you wish to translate. Choose the language you wish to translate to, and translate each of the desired LTEXT files, either manually or automatically via the Azure AI Text Translation service. Each LTEXT will turn green to indicate it has been translated. SC4LTEXTT can currently translate to all of the 18 languages supported in-game.

Each LTEXT GID will be incremented by the appropriate offset for the translated language. Currently all LTEXT files are written uncompressed.

It is important to note that due to reported issues with how Reader handles text encoding, certain 4-byte characters will appear as garbage data when viewed in Reader. This applies to all characters of languages such as Chinese, Korean, Thai, and Japanese, but also certain diacriticals for European languages too. If you open a file containing LTEXTs with these characters in Reader, DO NOT SAVE. If you do, the correctly functioning (but merely incorrectly displayed) characters will be overwritten by Reader with the garbage displayed characters.

 

This program is an extension of @rivit's great little LTEXTER tool and aims to make translation of LTEXT files significantly easier by managing all translations within the app (no need to export/import/edit in an external text editor), and critically, provide the opportunity for automatic translations for all the languages supported by the game.

More languages are possible; let me know if you have one you would like to add. An internet connection is required for the automatic translations. The translations are handled via the Azure AI Text Translation service - this service is free up to the first 2 million characters translated per month. I have set the limit so that when this threshold is reached, the program will no longer perform the automatic translations until the quota is reset at the start of the next month. Otherwise, by bank account would be on the hook for resources used over this limit, and I hope to avoid that! *:no:

 

Requirements

  • Windows 10 or higher
  • .NET7 runtime version > 7.0.0
    • To determine which version is installed, open Command Prompt and type dotnet --list-runtimes. If the version is less than 7.0.0 installed, download the most recent version here. Alternatively, if you run the executable without the correct .NET runtime, you will receive an error message. Follow the prompts to download the correct version.

 

Downloading

Download from the STEX or visit the latest release on Github. Both versions are identical.

 

Support
Consult the user manual, which contains information on both using the program and creating scripts with the new functionality introduced with this program.

This is an open source application. The source code and issue tracker are posted here. Requests or questions are welcomed here in this thread or in the Github issue tracker.


  Edited by nos.17  
  • Like 2
  • Thanks 1

Looking for a prop or texture? The SC4 Prop & Texture Catalog might help! View online here.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Hello, I have just done a simulation of the program: translation of a plugin of several dozen Lots. Each including its "title/name" LTEXT and its "description" generated during creation in PIM-X. Here are my remarks, based on this experience and those of translations of LTEXT "before" your program *;):
1 - In the left column, we see all the "description" strings then all the "titling" strings. With two or three sets, it's not a problem, but when dealing with larger files, it's a real problem to go looking far away for the other string with the same IID. Since the two, titling + description, are closely linked and the translation of one can, obviously, impact the other. I had the sad experience of this when translating the NAM on the Github translator, which displayed the same problem of "distance" from the two strings.
Do you think it is possible to associate strings based on their InstanceID, and not on the GroupID!?
I note that in the output file, you reassociate the LTEXTs (in pairs? or as they appeared from the original file?). I extend the reasoning: if I do not see a second string (even IID) it is because one of the 2 LTEXTs is "missing" in the case of Lots (intentionally or not is not the problem here!) , and for other types of plugin, it is a simple string like for the interface panels, ...
2 - After starting my translation, I realized that my original titlings (for example) were valid in English (US/EN) but had consequences that were unsuitable for certain languages. Or, there was an error, an extra or less character, forgetting a #nnn# variable... So, if we could take advantage of the opportunity to modify the original string it would be really practical. Not only a saving of time but the opportunity to give consistency to the texts of the same plugin.
Would a [edit/modify] button (with control: “Are you sure, man!” *:P) on the original strings be possible??

Thanks for your attention and for the work done here!

  • Like 1

What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

>> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    On 7/16/2024 at 7:33 AM, hugues aroux said:

    Hello, I have just done a simulation of the program: translation of a plugin of several dozen Lots. Each including its "title/name" LTEXT and its "description" generated during creation in PIM-X. Here are my remarks, based on this experience and those of translations of LTEXT "before" your program *;):
    1 - In the left column, we see all the "description" strings then all the "titling" strings. With two or three sets, it's not a problem, but when dealing with larger files, it's a real problem to go looking far away for the other string with the same IID. Since the two, titling + description, are closely linked and the translation of one can, obviously, impact the other. I had the sad experience of this when translating the NAM on the Github translator, which displayed the same problem of "distance" from the two strings.
    Do you think it is possible to associate strings based on their InstanceID, and not on the GroupID!?
    I note that in the output file, you reassociate the LTEXTs (in pairs? or as they appeared from the original file?). I extend the reasoning: if I do not see a second string (even IID) it is because one of the 2 LTEXTs is "missing" in the case of Lots (intentionally or not is not the problem here!) , and for other types of plugin, it is a simple string like for the interface panels, ...
    2 - After starting my translation, I realized that my original titlings (for example) were valid in English (US/EN) but had consequences that were unsuitable for certain languages. Or, there was an error, an extra or less character, forgetting a #nnn# variable... So, if we could take advantage of the opportunity to modify the original string it would be really practical. Not only a saving of time but the opportunity to give consistency to the texts of the same plugin.
    Would a [edit/modify] button (with control: “Are you sure, man!” *:P) on the original strings be possible??

    Thanks for your attention and for the work done here!

    Glad to see you are using it! *:lol:

    #2: Yes, I can do that! I might also provide an option to ask you if you want to redo all of the automatic translations too if you change the original text.

    #1: Can you further explain this? I am not quite understanding what you are asking.

    • Like 1

    Looking for a prop or texture? The SC4 Prop & Texture Catalog might help! View online here.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Hi,
    2 - oh yes, excellent idea!! .. But then... ;-) .. would it be possible to have a trigger for all trad'.. at once!? Because, unless you submit to an NI (Natural Intelligence) :)), barely mastering one of the languages (!) I must trust AZURE-AI!
    1 - Ok, no worries. For example: When creating a Lot there are two possible items: [...name key] and [...description key], therefore two LTEXTs with a different GroupID and the same InstanceID, which appear in the bubble of the game (hover over the menu button), in bold/large letters: [name key] and below [description key]. This is not an obligation, but a large number of Lotters have used and still use this practical option to have a generic and short [name] form and the detail in [description] in the menu bubble. We also find this construction in a large number of bubbles in the game's tools, which the NAM uses at will! Hence my question about the association of strings with the same IID (one after the other and the order doesn't matter!), in the LTEXTs enumeration column.

    • Like 1

    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    5 hours ago, hugues aroux said:

    Hi,
    2 - oh yes, excellent idea!! .. But then... ;-) .. would it be possible to have a trigger for all trad'.. at once!? Because, unless you submit to an NI (Natural Intelligence) :)), barely mastering one of the languages (!) I must trust AZURE-AI!
    1 - Ok, no worries. For example: When creating a Lot there are two possible items: [...name key] and [...description key], therefore two LTEXTs with a different GroupID and the same InstanceID, which appear in the bubble of the game (hover over the menu button), in bold/large letters: [name key] and below [description key]. This is not an obligation, but a large number of Lotters have used and still use this practical option to have a generic and short [name] form and the detail in [description] in the menu bubble. We also find this construction in a large number of bubbles in the game's tools, which the NAM uses at will! Hence my question about the association of strings with the same IID (one after the other and the order doesn't matter!), in the LTEXTs enumeration column.

    2: Yes, I can track whether a translation was submitted for AI translation or done manually. If submitted to Azure for translation, I can have an option to redo it - if it was translated by hand, I will indicate (perhaps with a different highlight color) that the text is "out of date" and requires being updated.

    1: Thanks, I understand the problem now. The Name Key and Description key for a lot can have very different IIDs - you would like to have them put next to each other or somehow grouped together to make editing easier. I think that could be possible if the file you open has an exemplar file that references the LTEXT files. If the LTEXT and Exemplar are in different dat files, I will not be able to do it.

    • Like 1

    Looking for a prop or texture? The SC4 Prop & Texture Catalog might help! View online here.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    1 hour ago, nos.17 said:

    If the LTEXT and Exemplar are in different dat files,

    Um.. I don't think it's useful to link/associate LTEXTs to their Exemplar, in your program. It often happens that LTEXTs are isolated from the Exemplars to which they are linked:  SC4 Locale, l NAM Locale, ... They are in a DAT alone! It’s even a necessity!
    I was just thinking about applying/forcing a sort on (before) the display of the strings column. Whatever DAT file is open. with or without an Exemplar. Sorting based on the instance, then on the Group of same instance.
    Thus, a DAT containing, for example, Lots created under PIM-X to which an LTEXT Name and a Description have been assigned, effectively have a Type 2026960b, a Group XXX for one and YYY for the other and the same ZZZ instance. For a Locale DAT like in NAM, this sorting before displaying the column makes it possible to preserve the pair (One LTEXT follows the other in the DAT) Name+Description.

    This is also the way to find a line (an IID) "more" easily *;)!!  (3000+ instances in NAM Locale!)

    • Like 1
    • Thanks 1

    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    On 7/20/2024 at 12:41 PM, hugues aroux said:

    I was just thinking about applying/forcing a sort on (before) the display of the strings column. Whatever DAT file is open. with or without an Exemplar. Sorting based on the instance, then on the Group of same instance.

    Unless I'm misunderstanding, I do already do this when opening a dat file with existing LTEXTs (relevant code). Does something interfere with this order?

    • Like 1

    Looking for a prop or texture? The SC4 Prop & Texture Catalog might help! View online here.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    12 hours ago, nos.17 said:

    Does something interfere with this order?

    Eh but I can almost read the code.. hihi.. vague memory of PHP-MySQL.
    Jokes aside.. This is precisely the problem, your code produces this:
    orderby Instance IN Group
    group | instance
    aaa | mmm
    aaa | nnn
    aaa | ooo
    ... | ...
    bbb | mmm
    bbb | nnn
    ccc | ooo
    ... | ...
    I understand the interest very well, since we have to increment the Group with each translation of a String. The problem is that the Strings are not in ascending (global) order and that this separates Strings which are "related". In my example we will admit that: aaa-ooo is the String Description linked to the String Name ccc-ooo. As I said previously, this is very common!!!
    What would be more sensible is this:
    Orderby Instance.. orderby Group (in instance!!)
    aaa | mmm
    bbb | mmm
    aaa | nnn
    aaa | ooo
    ccc | ooo
    ... | ...
    You're going to say: "Hey, it's a mess in the Groups!" (*:D "a mess ?? google translate !! that's not the word I used in French).
    No ! The Group is secondary! It's the instance, the String to translate that matters. So here, the order of groups is respected within an Instance : defaut, EN.., FR, DE
    This would allow you to easily exchange with another translator, or simply find your way around more easily when the DAT file is a little long.

    For example, find the two Strings 11a105f9 in NAM-Locale EN!? ... *:kitty:

    • Like 1
    • Thanks 1

    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Good morning, 
     
    When I (re)open (select by [Choose] button) a .dat file produced (function [save to new file]) by SC4LTEXT (0.4) I have this message in "input":

    Error: Could not decode LTEXT file in `scoty_SBS_A_languages_rd.dat` at position 0. File load terminated.
    Value was either too large or too small for a character.
       at System.Convert.ThrowCharOverflowException()
       at System.Convert.ToChar(Int32 value)
       at csDBPF.DBPFEntryLTEXT.Decode() in C:\source\repos\csDBPF\csDBPF\csDBPF\Entries\DBPFEntryLTEXT.cs:line 115
       at csDBPF.DBPFFileExtensions.DecodeEntries(IEnumerable`1 entries) in C:\source\repos\csDBPF\csDBPF\csDBPF\DBPFFileExtensions.cs:line 17
       at SC4LTEXTT.MainWindow.ChooseFile_Click(Object sender, RoutedEventArgs e) in C:\source\repos\SC4LTEXTT\MainWindow.xaml.cs:line 166

    The left column displays nothing!

    I produced this file from one of my .dat: set of Lots, containing for each of them the LTEXT-name and the LTEXT-description. Everything seems to be working fine. I've requested almost all languages (16/18). I've made some corrections to what's offered by the auto-translation. (I didn't ask for the translation of all the strings from my DAT). Then I saved it to a "new file". I wanted to check and review some sentences and... bam... this error! Any leads?? Thanks ...


    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    5 hours ago, hugues aroux said:

    Good morning, 
     
    When I (re)open (select by [Choose] button) a .dat file produced (function [save to new file]) by SC4LTEXT (0.4) I have this message in "input":

    
    Error: Could not decode LTEXT file in `scoty_SBS_A_languages_rd.dat` at position 0. File load terminated.
    Value was either too large or too small for a character.
       at System.Convert.ThrowCharOverflowException()
       at System.Convert.ToChar(Int32 value)
       at csDBPF.DBPFEntryLTEXT.Decode() in C:\source\repos\csDBPF\csDBPF\csDBPF\Entries\DBPFEntryLTEXT.cs:line 115
       at csDBPF.DBPFFileExtensions.DecodeEntries(IEnumerable`1 entries) in C:\source\repos\csDBPF\csDBPF\csDBPF\DBPFFileExtensions.cs:line 17
       at SC4LTEXTT.MainWindow.ChooseFile_Click(Object sender, RoutedEventArgs e) in C:\source\repos\SC4LTEXTT\MainWindow.xaml.cs:line 166

    The left column displays nothing!

    I produced this file from one of my .dat: set of Lots, containing for each of them the LTEXT-name and the LTEXT-description. Everything seems to be working fine. I've requested almost all languages (16/18). I've made some corrections to what's offered by the auto-translation. (I didn't ask for the translation of all the strings from my DAT). Then I saved it to a "new file". I wanted to check and review some sentences and... bam... this error! Any leads?? Thanks ...

    Hi, happy to see someone is using my tool! *:D

    Can you share or tell me where to find this scoty_SBS_A_languages_rd.dat? I will investigate.

    • Like 1

    Looking for a prop or texture? The SC4 Prop & Texture Catalog might help! View online here.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Oh cool! You're "around here" !! ;-)

    22 minutes ago, nos.17 said:

    happy to see someone is using my tool

    But yes *:D, not enough due to lack of time, .. but I would like to offer translations of certain plugins ! 

    I'm attaching another, shorter example (done 5 minutes later) with exactly the same proofreading "problem". My Lots file that I have SC4LTEXT read, and the file that I obtained (after all translation onebyone**) and wanted to reopen!

    scoty_SBStations_A_oneway.zip

    I take this opportunity : ** -> .. I'm a big lazybones then ..  a function: [all languages] =>Translate the (selected) string into all languages. With one click, that would be great!

    Whaaaaat ? I have already asked ??? .. rôôôôô ! *:blush: (insistent this guy)

    Thanks

     

    • Like 1
    • Thanks 1

    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    7 minutes ago, hugues aroux said:

    I take this opportunity : ** -> .. I'm a big lazybones then ..  a function: [all languages] =>Translate the (selected) string into all languages. With one click, that would be great!

    Yes! This is something I would like to achieve too. I just need to figure out how to correctly send the request to Azure, and then I can likely simplify significantly the code I need to write in the program. The application needs some love in more ways than one.

    • Like 2

    Looking for a prop or texture? The SC4 Prop & Texture Catalog might help! View online here.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    3 minutes ago, nos.17 said:

    The application needs some love in more ways than one

    .. yes, cuddle her, whisper sweet words and other encouragements to her...I used to do that to my web apps too! *:lol: 

    • Like 1
    • Yes 1

    What is good when you have nothing to say is that you can always pretend to listen. Anyway it does not prevent to think!

    >> My little plugins contribution << -- >> Depot | Fabrik | Testing <<

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Hey, I was using your tool already as well last winter, when I was tinkering with the submenues, and thought it was very useful (great idea to use an online translator). I had some issues with saving the file properly, but right now I can't remember what exactly it was (and unfortunately, I don't really have time for SC4 at the moment, maybe next winter again...). Otherwise, it was quite some help for adding a German translation to the original English files. Sure, you can do it with other tools, such as PIM-X, as well, but the workflow was more straightforward. :)

    • Like 1
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    5 hours ago, Andreas Roth said:

    Hey, I was using your tool already as well last winter, when I was tinkering with the submenues, and thought it was very useful (great idea to use an online translator). I had some issues with saving the file properly, but right now I can't remember what exactly it was (and unfortunately, I don't really have time for SC4 at the moment, maybe next winter again...). Otherwise, it was quite some help for adding a German translation to the original English files. Sure, you can do it with other tools, such as PIM-X, as well, but the workflow was more straightforward. :)

    Thanks! *:D

    It has been awhile since I looked, but I seem to recall that saving new LTEXTs into the current file was broken, but saving them to a new file worked alright.

    • Thanks 1

    Looking for a prop or texture? The SC4 Prop & Texture Catalog might help! View online here.

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections