transplate.lua - Languages support [1.0]

Share and discuss custom LunaLua code and content packs for SMBX2.
Core
Fuzzy
Fuzzy
Posts: 1110
Joined: Tue Apr 15, 2014 8:29 am
Flair: Bun~
Pronouns: she/her

transplate.lua - Languages support [1.0]

Postby Core » 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: https://pastebin.com/5xJVabUN (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: 6419
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?)

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

Re: transplate.lua - Languages support [1.0]

Postby Core » 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.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest