Forum Announcement, Click Here to Read More From EA_Cade.

Copying a bunch of strings from one STBL to another without overwriting the whole thing?

TriplisTriplis Posts: 3,048 Member
Maybe someone knows something about working with strings that will make this more efficient...

I'm down to basically the last thing before I release the next version of my Sorcerer mod, but due to how I've been doing things, I have a bunch of different ID STBL files with some of the strings for the mod and I want to compile them together into one set of STBL files (one set meaning one file for each language). Just so it's not sheer chaos for translators trying to go through a stupid number of STBL files to put together translations for one language.

Typically, I've been using Sims Studio when I want to combine stuff. In the past (before I had any actual translations) I could just compile the files once (in say, the English STBL file), then delete all of the other language STBL files and duplicate the English one, renaming the ID each time. Much more efficient, in other words, than adding a boatload of strings to 18 different files, one at a time.

But now that I have translations mixed in, that method only really works for files that are 100% English. For ones that are partly, or fully, translated, I can't just use a duplicate of an English file for it, or I'd lose the parts of it that are translated.

(Hopefully this makes sense. I'm really out of it right now and it seems a little confusing to me writing it lol.)

I think ideally, what I'm hoping for is some kind of tool where I can take an existing STBL file and copy/paste add a bunch of strings to it en masse.

Doing it manually for each is horribly inefficient, not to mention soul-crushing. Granted, only 6 of the files have actual translations, so most of them I could do with the duplication method. But the problem is only going to be worse the more translations that are made for the mod, if I ever add strings to it again beyond this update.

Edit: Oh and to give a sense of proportion of how horribly inefficient it is doing it for each one... I have something like 150 strings to add to the "main" files. :lol:
Mods moved from MTS, now hosted at: https://triplis.github.io
Post edited by Triplis on

Comments

  • cmarinetticmarinetti Posts: 147 Member
    Sounds easy enough to make a little tool to mush all the strings for each language into one STBL, if you still need it?
    cmarNYC on MTS.
  • TriplisTriplis Posts: 3,048 Member
    cmarinetti wrote: »
    Sounds easy enough to make a little tool to mush all the strings for each language into one STBL, if you still need it?
    @cmarinetti

    I could still use a tool, yes, if it's possible. And just to be sure we're on the same page, when you say mush into one STBL, do you mean one STBL for each language, or one STBL with all languages in it? The first one is what I'm wanting.

    Like English1, English2, English3, combined into English1, with all the English strings in it. And then the same for other languages too. Ideally with the kind of setup Sims Studio has, where you can add by string ID and name if you want to (but with being able to do it en masse, not only one at a time). If it was just a program that looked at STBL files and mushed their contents together automatically, that'd definitely be helpful too. Just not as flexible as I'd prefer.

    But I'll take what I can get if it speeds up some of the horrible inefficiency I'm facing.

    Hope that makes sense. Let me know if not and I'll try to clarify further.
    Mods moved from MTS, now hosted at: https://triplis.github.io
  • cmarinetticmarinetti Posts: 147 Member
    edited June 2017
    Makes perfect sense. Yes, I meant each language combined into a separate file - mushing them all into one would be pretty useless! :) Let me look at it - being able to select by string/ID adds a bit more work but probably not much. I did an STBL tool for TS3 so can steal some of that code; I don't think the STBL format has changed much if at all. It's late here, give me a day.
    cmarNYC on MTS.
  • TriplisTriplis Posts: 3,048 Member
    @cmarinetti Awesome, thanks! I look forward to seeing what you come up with.
    Mods moved from MTS, now hosted at: https://triplis.github.io
  • cmarinetticmarinetti Posts: 147 Member
    edited June 2017
    Okay, I ported my TS3 tool for TS4 and added a batch string copy function.

    Go to the Musher tab, click on the STBL you want to copy from and the STBL file you want to copy to. (It'll look like they're selected when you first open it but they're not.) You'll see a list of strings in the Copy-From file with checkboxes to select the ones you want. Then click Copy.

    Please keep a backup of your original package(s) just in case, I haven't had time for much testing. The modified STBLs work in s4pe but I haven't tested at all in-game, so you might want to do a quick test with one language just in case.

    That's all I have time or energy for today! Please let me know how it works and of problems so I can fix them!

    Oh, and in future you can use this tool to add strings to all the languages at the same time - maybe keep you from getting into this situation again. You might also try the export to xml / import from xml functions for translations.

    I uploaded it over on MTS: http://www.modthesims.info/showthread.php?t=596197

    Edit: There's a very weird bug going on; when you copy strings in languages other than your main language, they don't show up in the Languages List tab Edit buttons. They seem to be added okay, though. I'll have to fix that tomorrow.
    Post edited by cmarinetti on
    cmarNYC on MTS.
  • TriplisTriplis Posts: 3,048 Member
    @cmarinetti Thanks so much! I will be sure to let you know how it goes. :)
    Mods moved from MTS, now hosted at: https://triplis.github.io
  • cmarinetticmarinetti Posts: 147 Member
    edited June 2017
    @Triplis The weird bug turned out to be me confusing Spanish with Portuguese and clicking on the wrong language. No wonder I couldn't find the problem! Anyway it seems to work okay but test and keep backups. I'm off to have a drink!
    cmarNYC on MTS.
  • TriplisTriplis Posts: 3,048 Member
    @cmarinetti Ok, cool, thanks! Enjoy your drink. :)
    Mods moved from MTS, now hosted at: https://triplis.github.io
  • TriplisTriplis Posts: 3,048 Member
    edited June 2017
    @cmarinetti So I think I ran into an issue (I think it's an issue, I keep sitting down to use your tool and getting distracted by something).

    The gist is, the windows don't seem to be adjusting to screen size and I can't seem to drag them into view to see everything at once (and I think they're overlapping, so scrolling isn't showing me everything I need to see either).

    Here's a screenshot of what I mean, in fullscreen, on the Musher tab:

    ZRuQxko.png

    If I adjust one window to see most of another, that one is now mostly hidden. And I'm not finding the Copy button in the Musher tab, so I suspect it's hidden at the bottom somewhere beyond where I can see it.

    In case it means anything, I'm on Windows 10, with a 1366x768 monitor.

    I'm going to see if I can work around the problem for now.

    Only other "issue" I noticed so far is that in the Language List, if you hit Edit, it seems to cut off the list such that you can only see the strings in that list of the lowest number file. So say I have one file with 110 and one with 100, both files only show 100 in the Edit window. I don't think that particular thing should cause any problems with Mushing though, as in the Musher tab, it's showing up with the correct number of strings.
    Mods moved from MTS, now hosted at: https://triplis.github.io
  • cmarinetticmarinetti Posts: 147 Member
    I've run into that resizing problem before (if it's what I think it is), just have to try to remember the fix. It works correctly for me but there's a rather obscure setting that's probably different between our computers. I'm also on Win10.

    As for editing the strings in the Language list, that's based on your primary language - by default English but you can change it in Settings - the list consists of the strings in the primary language with the corresponding strings in the translated language. Any translated language strings that are missing show as blank, and any that are not in the primary language won't show. The program really isn't intended to work with inconsistent sets of strings.
    cmarNYC on MTS.
  • cmarinetticmarinetti Posts: 147 Member
    @Triplis - Fixed! New version is uploaded at MTS, let me know if it's working okay now. It's a DPI issue - I use large scaling - along with me forgetting to make sure the controls are anchored properly. This was an old app made before I understood how to handle this.
    cmarNYC on MTS.
  • TriplisTriplis Posts: 3,048 Member
    @cmarinetti Oh ok, thanks for clarifying that! Anywho, got it working with the fixed version, woot woot. :)

    Only thing I should probably mention, in case it means something to you... really kind of a big question mark on my end... is I had a package that I Mushed strings to. Everything worked fine on the functionality end as far as I can tell. Then I "saved as..." the package, extracted its STBLs (which is usual procedure for me when editing them, to edit outside of the main package file for the mod), imported them into the main package file, saved it as a new copy, etc.

    The weird part is, this gave me problems when Sims 4 tried to run. Just immediate crash without even loading at all. I still have the crash file and can PM it to you or something if you're curious and/or have any idea how to read those things.

    But anyway, I thought ok, maybe it's some kind of funkiness with how the files were saved. So on blind theory, I tried loading up a copy of the Mushed STBL package into Sims Studio, hit Save (with no changes made), then went through the process again of extracting (this time from the "saved in Sims Studio" version) and importing to my main package file, tried my main package file again, and this time no crash.

    Doesn't make a whole lot of sense to me, but it worked.

    Either way though, the strings are now "mushed" and seem to be working in-game so far. So thanks again! :)
    Mods moved from MTS, now hosted at: https://triplis.github.io
  • cmarinetticmarinetti Posts: 147 Member
    Hmm, probably I messed something up in saving the files, something the game chokes on but S4S doesn't. What would help is if you could upload the same STBL, broken version and after S4S version.

    Oh, and did you edit using s4pe? I think I saw a bug in the code for saving after modification but I didn't test.
    cmarNYC on MTS.
  • TriplisTriplis Posts: 3,048 Member
    @cmarinetti Sure, I think I did it with copies. Here's what I'm pretty sure is the before and after:

    http://simfileshare.net/filedetails/261450/

    http://simfileshare.net/filedetails/261449/

    I use s4pe for the main importing/exporting/packaging everything together, etc., if that answers your question. I pretty much have only used Sims Studio in the past for editing strings.
    Mods moved from MTS, now hosted at: https://triplis.github.io
  • cmarinetticmarinetti Posts: 147 Member
    edited June 2017
    Thanks. Never mind, I found the problem, fixing now. s4pe was right and I was wrong, of course.

    Edit: And it's fixed; edited STBLs no longer crash the game and hopefully work okay. Sorry about all the bugginess, doing something fast like this without enough testing is never good.
    Post edited by cmarinetti on
    cmarNYC on MTS.
  • TriplisTriplis Posts: 3,048 Member
    @cmarinetti No worries! Nice work fixing it, that was fast. I'll download the updated version now to make sure I don't forget and use the old one in the future. Thanks again for your work on this! A real lifesaver.
    Mods moved from MTS, now hosted at: https://triplis.github.io
  • cmarinetticmarinetti Posts: 147 Member
    Glad to help! :)
    cmarNYC on MTS.
Sign In or Register to comment.
Return to top