Announcement

Collapse
No announcement yet.

How can I get a list of packages, and iterate through all of the content in those packages?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I get a list of packages, and iterate through all of the content in those packages?

    I'm writing a localization system from scratch. For the simplest stuff I have a file, Localization.ini, that contains a bunch of translated strings that the game can look up. I use it for messages like "Critical Hit!" and "Level Up!" I even use it for translating terms on the character sheet. But I'm going to need a lot more than that. I think I know what I need to do, and I know how to do all of it except the last step here:
    • All actors in the game world that have string properties in need of localization write to a json file that I can later update manually with localizations of all their strings.
    • Do the same for all Kismet nodes (which I use for my dialog system) that have string properties in need of localization, likewise populating a json file.
    • Do the same for all archetypes saved in my game's upk files, creating a json file where I can enter localizations.
    The idea is that any time I want to access a string property in a placed actor, a Kismet sequence action, or an archetype, I will look up said actor, sequence action, or archetype in the appropriate json file, and get the localized string from there. I just need to create the files. I'm pretty sure I can get the data I need from the first two bullet points above. But I have no idea how to get a list of packages and iterate through the content of those packages.

    Any ideas?
    Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

    #2
    As a last resort, I could build localizations into each individual class that contains strings, but I really want to save that as a last resort.
    Check out Himeko Sutori, the upcoming tactical RPG where you control armies of over 100 unique characters.

    Comment


      #3
      Nathaniel3W Here's how I've implemented my own localization system:

      I created a MyTranlation.uc class that extends Object.uc. This class simply implements String vars for each string to be translated (with the English phrases added in the default props).

      For every language I support, I extend the class for that language (so MyTranslation_DE.uc, MyTranlation_FR, etc) and add the translated strings in the those classes.

      Then when the game starts (or the language is changed in game by the player), i instance this class for the required language and add a ref to it in a constant class (i use my player controller).

      Then each time I want to pull a localized string I simply reference this class. I have a few static methods to make the syntax easy to access/use in whatever other class (as well as ways to inject strings into the translated phrases, etc).

      To manage the many languages I support, I have setup google sheets and some simple scripts for adding new phrases. I have given translators access to the sheets so they can add/edit the translated phrases. Then I have a script that pulls all the different languages from all the sheets and populates the default props of each of the language's .uc files.

      I'm sure there are many other ways of doing this (as well as using .ini files and have the strings as config vars), but this is working pretty well for me. And it allows players to change the language during run-time, without a game restart.
      Last edited by Coldscooter; 11-12-2019, 05:15 PM.

      Comment

      Working...
      X