# Localizing Widgets for Global Audiences

**URL:** https://community.elfsight.com/t/localizing-widgets-for-global-audiences/86761
**Category:** General Questions
**Tags:** new-widget, website-translator
**Created:** [December 3, 2024, 2:12pm UTC](https://community.elfsight.com/t/localizing-widgets-for-global-audiences/86761 "2024-12-03T14:12:34Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![muhammad\_ali](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/muhammad_ali/32/41430_2.png) [@muhammad\_ali](https://community.elfsight.com/u/muhammad_ali)
#### Post date: [December 3, 2024, 2:12pm UTC](https://community.elfsight.com/t/localizing-widgets-for-global-audiences/86761/1 "2024-12-03T14:12:34Z")

</div>

Some of my friends are admiring the Elfsight widgets from last few months. So, recently one of my clients approached me to use Elfsight widgets on thier language and translation services based website to serve a global audience.

Can you please explain me its features, that what are best practices for localizing widgets to make sure that these designs are user-friendly for different languages and regions?

---

<div class="post-metadata">

### Author: ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)
#### Post date: [December 3, 2024, 6:07pm UTC](https://community.elfsight.com/t/localizing-widgets-for-global-audiences/86761/3 "2024-12-03T18:07:36Z")

</div>

Hi there, @muhammad_ali 👋

I am afraid I didn’t quite understand your question. What widgets are you interested in: only Website Translator or maybe another ones?

If you mean the Website Translator widget only, it translates the whole content of the page where it’s installed to the chosen language.

If you have any further questions, please describe them in more detail 🙂

---

<div class="post-metadata">

### Author: ![Helga](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/helga/32/1155_2.png) [@Helga](https://community.elfsight.com/u/Helga)
#### Post date: [December 4, 2024, 7:38am UTC](https://community.elfsight.com/t/localizing-widgets-for-global-audiences/86761/4 "2024-12-04T07:38:17Z")

</div>

Hi @muhammad_ali, we’re so happy you’re considering our widgets ☺

I agree with Max, some more details about your use case and what widgets you’d love to use could help us better understand your needs 🙂

However, if you’re referring to the Website Translator widget, we have some more info about it [in this post](https://community.elfsight.com/t/new-widget-make-your-website-even-greater-with-a-new-website-translator/60606). Actually, I recommend testing the widget out to see what features and options it includes. And if you have any specific questions, feel free to ask us here!

---

<div class="post-metadata">

### Author: ![muhammad\_ali](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/muhammad_ali/32/41430_2.png) [@muhammad\_ali](https://community.elfsight.com/u/muhammad_ali)
#### Post date: [December 4, 2024, 8:31am UTC](https://community.elfsight.com/t/localizing-widgets-for-global-audiences/86761/5 "2024-12-04T08:31:09Z")

</div>

My question is

Many plugins are there to translate one language into a specific language but I want my content to be translated across all countries and all famous languages according to the geography of the users.

So I have two options, first one is to use these plugins(but such multiple plugins will crush my website speed optimization factors, so I am more interested in such dsigns that should be allocated according to the locations of users(if any feature exist till date).

We are offering certified translation services, so you can get that proper translation is always important in such cases.

So, I am interested in this.

Hopefully, you will get my response.

Thanks

---

<div class="post-metadata">

### Author: ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)
#### Post date: [December 4, 2024, 12:14pm UTC](https://community.elfsight.com/t/localizing-widgets-for-global-audiences/86761/6 "2024-12-04T12:14:42Z")

</div>

Hi there, @muhammad_ali 👋

If I got you right, you’d like to implement the automatic translation of the page based on the user’s language.

In this case, you need to add the needed languages to your Website Translator widget and add this script to your website’s head:

```auto
<script>
        (() => {
                const DEFAULT_LANGUAGE = 'en';

                const url = new URL(location.href);

                const key = Object.keys(localStorage).find((key) => key.startsWith('WebsiteTranslator.language'));
                const hasCachedValue = !!JSON.parse(localStorage.getItem(key) || '{ "value": false }').value;

                const language = navigator.language.split('-')[0];
                if (url.searchParams.has("lang") || language === DEFAULT_LANGUAGE || hasCachedValue) {
                        return;
                }

                url.searchParams.set("lang", navigator.language);
                history.replaceState(null, '', url);
        })();
</script>

```

  

If the default language isn’t English, you need to change it in the 3rd line of the code:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/elfsight/original/3X/2/3/23e2bca10d113bfb9ad6dd44e90a0968662e43d4.png)

  

This way, the language will be pulled from the user’s browser and the page with the widget will be automatically translated to this language (providing you’ve added this language to your Website Translator widget).

We also guess that it would be great to have this feature in the settings, and I’ve added this idea to the Wishlist on your behalf - [Automatically translate the page to the language of the user location](https://community.elfsight.com/t/automatically-translate-the-page-to-the-language-of-the-user-location/86933)

Let me know if you have any further questions 🙂
