language by choosing "county flag emoji" the emoji...
# 🤝help
s
I followed the tutorial on BP youtube, and liked the idea of cliking an emojo for preferred language. But it seems as windows(10) does not regonize the unicode for the flags. There isn't any flags build in (win+.) And when i try to copy it from emojipedia every flag is just there two letter code:
a
Hey @sparse-laptop-4203 you can use the actual emojis in code like this:
Copy code
js
if (event.preview == '🇬🇧') {
  user.TranslatorAgent.language = 'en'
} else if (event.preview == '🇫🇷') {
  user.TranslatorAgent.language = 'fr'
} else if (event.preview == '🇪🇸') {
  user.TranslatorAgent.language = 'es'
} else if (event.preview == '🇨🇳') {
  user.TranslatorAgent.language = 'zh'
}
That video has a great companion tutorial on Discord here https://discord.com/channels/1108396290624213082/1120796649686573086
s
Ah now I know where the confusion came from. My Microsoft edge browser is apparently not able to show the emojis. But it were your message that made it obivous becase I saw it on the mobile app where your message contained the emoji, and not the unicode 😄
Thanks alot Gordy ❤️
a
got this flag issue now to 🙂 as a workaround to another solution i want the user to choose from flags but they wont appear even after copying this code from @acceptable-kangaroo-64719 still no flags to see. i'm using chrome btw 🙂
a
You can check how flag emojis are rendering on your machine by sending one to your bot and then checking the logs. If you send 🇬🇧 but the logs say 'GB' you should use 'GB' in your code
a
it says " 🇬🇧 " in the logs in small letters of GB - the actual flag got "created" bei copying gb from the logs
by copying this flag or gb to my capture card or my execute script didnt do anything. The language choosing button en/gb still says gb in small letters
a
interesting. I wonder if you'd have better success converting the emoji to unicode or smth and then doing your if/then based on that unicode value
ChatGPT says try
const unicodeCodePoint = emoji.charCodeAt(0).toString(16).toUpperCase();
You can log that value and then add that to your if/else statement
d
Hi Gordy, watched you video could you clear up if this works on Windows machines and if there is a remedy for only seeing letters?
a
hey buddy, shouldn't matter if it is windows/mac/linux because this code runs on Botpress servers. You can do some experiments and try things out,
console.log()
the results, etc. That code is from chatGPT so I have no idea if it actually works or not
q
If you've used "en" as the language, shouldn't the flag technically be the US flag as the default from what i can tell is american english. e,g, "Specialize" I'm actually looking at coverting to UK english right now.
5 Views