Site icon Hip-Hop Website Design and Development

show totally different content material on the identical web page utilizing totally different URLS

I utilizing wordpress. I’ve question string functionally that shows the content material within the right language.

Instance urls

instance.com/privateness/?lang=en
instance.com/privateness/?lang=es
instance.com/privateness/?lang=fr
instance.com/privateness/?lang=db

Code on page-privacy.php

<script kind="text/javascript" charset="UTF-8">   
  var langCodeSearch = new URLSearchParams(window.location.search);
  var langCode = Object.fromEntries(langCodeSearch.entries());

              
   Api.Initialized.then(operate() {
    Api.LoadContent(["https://url-to-api-that-has-content.json"], langCode.lang //**language declaration have to occur right here**);
              });
</script>

The above code works nice however wouldn’t it be doable to have the identical functionally however utilizing the next URL construction?

instance.com/privateness/en
instance.com/privateness/es
instance.com/privateness/fr
instance.com/privateness/gb

I wish to show content material based mostly on the final a part of the URLs.