default element
This commit is contained in:
parent
937627b879
commit
a8a0c36e51
2 changed files with 6 additions and 2 deletions
|
@ -96,7 +96,7 @@ export default async (message: Message, client: Client) => {
|
||||||
// Remove undefined elements
|
// Remove undefined elements
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|
||||||
const loc = getLocale(client, client.config.default_lang);
|
const loc = getLocale(client);
|
||||||
|
|
||||||
// Remove duplicates then map the quoted posts
|
// Remove duplicates then map the quoted posts
|
||||||
[...new Set(messages)]
|
[...new Set(messages)]
|
||||||
|
|
|
@ -81,9 +81,13 @@ export const getLocalizations = (client: Client, text: string, lowercase = false
|
||||||
* @param lang Lang to fetch
|
* @param lang Lang to fetch
|
||||||
* @returns the map with the desired languaged clogged with the default one
|
* @returns the map with the desired languaged clogged with the default one
|
||||||
*/
|
*/
|
||||||
export const getLocale = (client: Client, lang: string) => {
|
export const getLocale = (client: Client, lang: string | undefined = undefined) => {
|
||||||
// Load default lang
|
// Load default lang
|
||||||
const default_locales = client.locales.get(client.config.default_lang);
|
const default_locales = client.locales.get(client.config.default_lang);
|
||||||
|
if (!lang) {
|
||||||
|
return default_locales!;
|
||||||
|
}
|
||||||
|
|
||||||
// Load desired lang
|
// Load desired lang
|
||||||
const desired_locales = client.locales.get(lang);
|
const desired_locales = client.locales.get(lang);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue