i18n question

So this works
applyLocalizedBuilder(builder, 'commands/names', 'commands/descriptions:name')
applyLocalizedBuilder(builder, 'commands/names', 'commands/descriptions:name')
but when I use applyLocalizedBuilder(builder, 'commands:ping') I get
Invalid string format
2023-07-16 02:17:47 - ERROR -
2023-07-16 02:17:47 - ERROR - Expected: expected /^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u.test(expected) to be true
2023-07-16 02:17:47 - ERROR -
2023-07-16 02:17:47 - ERROR - Received:
2023-07-16 02:17:47 - ERROR - | 'pingName'
Invalid string format
2023-07-16 02:17:47 - ERROR -
2023-07-16 02:17:47 - ERROR - Expected: expected /^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u.test(expected) to be true
2023-07-16 02:17:47 - ERROR -
2023-07-16 02:17:47 - ERROR - Received:
2023-07-16 02:17:47 - ERROR - | 'pingName'
13 Replies
Mikkel
MikkelOP2y ago
Is this possibly cause the layout is different when I use it like this? Also another question how do I put resolveKey into the same statement as content: as if I do it I have to do as string but nof it I do it's own line
Favna
Favna2y ago
The latter implies there is a file called commands.json which has keys pingName and pingDescription. You don't have that so it resolves to pingName which is invalid so through @sapphire/shapeshift validations that @discordjs/builders uses an error is thrown. You should also have an understanding of the i18next API when using this plug-in: https://www.i18next.com/overview/getting-started I really don't understand this question. Please provide examples. Also:
Spinel
Spinel2y ago
When asking for help, make sure to provide as much detail as possible. What have you tried so far? Do you have stacktraces that you can show us? What are you trying to achieve? Try to answer these questions and others, so we do not have to ask for them afterwards.
❯ For a good guide on how to ask questions, see the instructions that StackOverflow gives. You should try to always follow these guidelines. ❯ For an excellent video that shows how not to ask technical questions is this, watch this YouTube video by LiveOverflow. ❯ Asking technical questions (Clarkson)How to ask questions the smart way (Raymond)
Mikkel
MikkelOP2y ago
Thank you that clears it up
Mikkel
MikkelOP2y ago
this works
Mikkel
MikkelOP2y ago
So does this
Mikkel
MikkelOP2y ago
But this does not I am not sure what the difference is
Mikkel
MikkelOP2y ago
Why do I have to explicitly cast it, or is it inferred when I use const? I am not sure this is a framework question but it's the first time I stumble upon it
Favna
Favna2y ago
What's the error it gives
Mikkel
MikkelOP2y ago
Favna
Favna2y ago
resolveKey's return type is string | null and content has to be string | undefined so yeah that error makes sense. Instead of casting it, you should write it as
(await resolveKey(...)) ?? undefined
(await resolveKey(...)) ?? undefined
though you should actually check if the resolved key gives a string value before even trying to send it.
Mikkel
MikkelOP2y ago
how come in the example below it works like here What's the difference to that and then just putting it directly in?
Favna
Favna2y ago
Idk tbh
Want results from more Discord servers?
Add your server