Skip to content

Lua string hashing library, useful for internationalization

License

Notifications You must be signed in to change notification settings

lunarmodules/say

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3e1f783 · Aug 12, 2023

History

81 Commits
Aug 23, 2022
Aug 27, 2022
Aug 27, 2022
Aug 27, 2022
Aug 23, 2022
Dec 2, 2020
Dec 2, 2020
Dec 2, 2020
Aug 20, 2022
Aug 22, 2012
Aug 12, 2023
Aug 27, 2022

Repository files navigation

Say

Busted Luacheck GitHub tag (latest SemVer) Luarocks

say is a simple string key/value store for i18n or any other case where you want namespaced strings.

Check out busted for extended examples.

s = require("say")

s:set_namespace("en")

s:set('money', 'I have %s dollars')
s:set('wow', 'So much money!')

print(s('money', {1000})) -- I have 1000 dollars

s:set_namespace("fr") -- switch to french!
s:set('wow', "Tant d'argent!")

print(s('wow')) -- Tant d'argent!
s:set_namespace("en")  -- switch back to english!
print(s('wow')) -- So much money!

NOTE: the parameters table can have nil values, but in that case it must have an n field to indicate table size.

s = require("say")

s:set('money', 'I have %s %s')

print(s('money', {1000, "dollars"})) -- I have 1000 dollars
print(s('money', {nil, "euros", n = 2})) -- I have nil euros

About

Lua string hashing library, useful for internationalization

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages