transplate.lua - Languages support [1.1]

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

KateBulka
Fuzzy
Fuzzy
Posts: 1112
Joined: Tue Apr 15, 2014 8:29 am
Flair: Bun~
Pronouns: she/her

transplate.lua - Languages support [1.1]

Postby KateBulka » Tue Nov 01, 2022 3:10 pm

transplate.lua

So... This is a library you can use to translate strings! Sounds fun, right? Well, it's mostly a library that you should know how to use, but there is plans to integrate library with other libraries. For now transplate.lua works with littleDialogue by MrDoubleA, you can even change fonts for specific/all style(s)!

Library:
1.1 (Current) - https://pastebin.com/upbGbX5H
1.0 - https://pastebin.com/5xJVabUN
P.S: I recommend naming file transplate.lua

How to use?:
Spoiler: show
Image

To switch language you can do this in luna.lua file:

Code: Select all

local transplate = require("transplate")
transplate.setLanguage("Example") -- a language folder should exist with that name!!
You can also switch various settings on the top of library:
Image
For move advanced users: You can get translation of string:

Code: Select all

-- worth mentioning that it returns original text if there is no translation
local translated = transplate.getTranslation(text, lang (by default it's current language))

Bug reports, recommendations and etc are welcome! This library was a bit rushed honestly :)

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6422
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

Re: transplate.lua - Languages support [1.0]

Postby MECHDRAGON777 » Sun Nov 06, 2022 12:43 am

Out of curiosity, how many languages does this currently support? (Like, if I wanted Japanese, English, and Spanish; would I be able to use this to implement that, or just English and a default specific other language?)

KateBulka
Fuzzy
Fuzzy
Posts: 1112
Joined: Tue Apr 15, 2014 8:29 am
Flair: Bun~
Pronouns: she/her

Re: transplate.lua - Languages support [1.0]

Postby KateBulka » Thu Nov 17, 2022 10:09 am

MECHDRAGON777 wrote:
Sun Nov 06, 2022 12:43 am
Out of curiosity, how many languages does this currently support? (Like, if I wanted Japanese, English, and Spanish; would I be able to use this to implement that, or just English and a default specific other language?)
You have to write your lang files by yourself.

KateBulka
Fuzzy
Fuzzy
Posts: 1112
Joined: Tue Apr 15, 2014 8:29 am
Flair: Bun~
Pronouns: she/her

Re: transplate.lua - Languages support [1.1]

Postby KateBulka » Sat Feb 18, 2023 6:46 am

1.1 is out!! Now it has integration with Marioman2007's pauseMenu.lua and now it translates answers and speaker names correctly with littleDialogue!!
(Also now it can change graphics depending on language x) )

Download link is in topic <3

Captain Ben
Goomba
Goomba
Posts: 2
Joined: Sun May 23, 2021 1:59 pm
Pronouns: he/him
Contact:

Re: transplate.lua - Languages support [1.1]

Postby Captain Ben » Fri May 26, 2023 12:02 pm

Should I write global tables to save switched language in luna.lua?


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari