Skip to content

Allow String keys in Localization Strings and Add default loc_vars function#330

Closed
Cheesy-Brik wants to merge 5 commits into
Steamodded:mainfrom
Cheesy-Brik:extended-localization-features
Closed

Allow String keys in Localization Strings and Add default loc_vars function#330
Cheesy-Brik wants to merge 5 commits into
Steamodded:mainfrom
Cheesy-Brik:extended-localization-features

Conversation

@Cheesy-Brik
Copy link
Copy Markdown
Contributor

Adds a default loc_vars function and allows for returned args from loc_vars to use not just number keys but also string keys. Alters the localization function directly so the string key change can be used in any text field as long as the args has that string key.

Example:

SMODS.Joker {
    key = 'pacifist',
    loc_txt = {
        name = 'Pacifist Joker',
        text = {"Played cards with", "{C:spades}#suit#{} suit give", "{C:chips}+#chips#{} Chips when scored"}
    },
    config = {
        chips = 50,
        suit = 'Spades'
    },
...

Would remove a lot of boilerplate and would probably mean most people would never have to interact with the loc_vars function

It also reads the extra table as a fallback if the key doesn't exist.

@Cheesy-Brik Cheesy-Brik changed the title Extended localization features Allow String keys in Localization Strings and Add default loc_vars function Dec 14, 2024
@Aurelius7309
Copy link
Copy Markdown
Member

Not needed or wanted in terms of directing new modders towards learning concepts properly, as discussed on Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants