-- lx-bundle:true

-- This file is part of Lx, created by Liqube <www.liqube.com>
-- Copyright Liqube Audio. All rights reserved.
-- Lx Interim License. See LICENSE for details.

local loc = require("core.i18n.loc")

loc.register_translations("demo", {
	["6p2m8v4k9q3n7x5r"] = {
		de = {
			male = "Willkommen, mein Herr",
			female = "Willkommen, gnädige Frau",
			other = "Willkommen",
		},
	},
	["5x9q3n7m2v6k8r4d"] = {
		de = {
			[0] = "Keine Nachrichten",
			one = "Eine Nachricht",
			other = "{count} Nachrichten",
		},
	},
	["8v4k2m6q9x3n7r5d"] = {
		de = loc.dedent([[
    Hallo {name},

    Du hast {p:n
        0{keine neuen Nachrichten}
        one{eine neue Nachricht}
        other{{n} neue Nachrichten}
    }.

    Viele Grüße
    Support
    ]]),
	},
})

loc.set_locale("de")
loc.precompile_all()

print(loc.select("6p2m8v4k9q3n7x5r", "female", {
	male = "Welcome, sir",
	female = "Welcome, ma'am",
	other = "Welcome",
}))
-- -> Willkommen, gnädige Frau

for _, count in ipairs({ 0, 1, 5 }) do
	print(loc.plural("5x9q3n7m2v6k8r4d", count, {
		[0] = "No messages",
		one = "One message",
		other = "{count} messages",
	}))
end
-- -> Keine Nachrichten
-- -> Eine Nachricht
-- -> 5 Nachrichten

print(loc.text("8v4k2m6q9x3n7r5d", loc.dedent([[
    Hello {name},

    You have {p:n
        0{no new messages}
        one{one new message}
        other{{n} new messages}
    }.

    Regards,
    Support
]]), {
	name = "Tom",
	n = 2,
}))
