Can the JS component detect device language?

Hi, I’m using pragmaflows JS component to get the users device language, but it’s not detecting it. the code should be correct as it’s made by a programmer instead of AI, but it still does not detect it. Anyone with a similar problem?

I removed the code comments when putting it in

var navigatorLocale = navigator.language || navigator.userLanguage;

  var supportedLanguages = [
    'en', // English
    'es', // Spanish
    'pt', // Portuguese
    'de', // German
    'it', // Italian
    'ar', // Arabic
    'ru', // Russian
    'fr'  // French

  var defaultLanguage = 'en'; // English is the default language

  let userLocale = navigatorLocale?.split('-')[0].toLowerCase() ?? defaultLanguage
  if (supportedLanguages.indexOf(userLocale.toLowerCase()) === -1) {
    userLocale = defaultLanguage;

  return userLocale;


Hi Axel,

Working for me! Did you entered true in here?

Screenshot 2023-09-22 021058

Thank you

yes, but it always returns en. it does not detect any other language. if I set my device to spansih, it won´t detect it.

No problems in here and I get the correct code for my device language. Are you testing this on a mobile or a desktop? Did you changed your browser language while opening the app? If it is reload your app after changing the language and check again!

can you show me a video of it working for you, please?

I’ve tested on app and on computer preview and it’s not working

Sure! I’ll share a video today!


Axel, here’s the video! : Language change adalo.mp4 - Google Drive

Sorry for the late reply! If you like, me to check your app I happy to look at it! ( send me a dm )

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.