feat: help command #36
1 changed files with 5 additions and 2 deletions
|
@ -53,18 +53,21 @@ export const loadLocales = async (default_lang: string) => {
|
|||
* @param text Name of string to fetch
|
||||
* @returns the dictionary
|
||||
*/
|
||||
export const getLocalizations = (client: Client, text: string) => {
|
||||
export const getLocalizations = (client: Client, text: string, lowercase = false) => {
|
||||
const data: Record<string, string> = {};
|
||||
|
||||
// Load all the localizations
|
||||
client.locales.forEach((locale, lang) => {
|
||||
// Fetch the text and fallback to default lang if needed
|
||||
// See getLocale for more info on why we *can* fallback
|
||||
const str = locale.get(text)
|
||||
let str = locale.get(text)
|
||||
?? client.locales.get(client.config.default_lang)?.get(text);
|
||||
|
||||
// Store it if defined
|
||||
if (str !== undefined) {
|
||||
if (lowercase) {
|
||||
str = str.toLowerCase();
|
||||
}
|
||||
data[lang] = str;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue