N
N
Nikola242017-02-10 17:36:35
JavaScript
Nikola24, 2017-02-10 17:36:35

Multilingual website in javascript?

There is a website, there are 4 pages on the website. The total sum of characters from all 4 pages is ~1000. There are 5 languages, it is necessary that these ~ 1000 characters be in 5 languages, I don’t want to use PHP, the only option that came to my mind was to use javascript. How will Google's indexing react to all languages ​​if English is initially set. If there are other suggestions for the implementation of multilingualism, please write!

Answer the question

In order to leave comments, you need to log in

8 answer(s)
1
1011, 2017-02-10
@Nikola24

it is better to set up the url of the pages using php: site.com/ru site.com/en
ps Here is what the search engines write: Yandex :

Every AJAX indexed page must have an HTML version. To indicate to the robot that there is an HTML version of a page, include an exclamation point in the page URL:
www.example.com/#blog > www.example.com/#!blog

Google
When creating links, you should choose a format that allows you to offer a static link along with calling a JavaScript function. This way, users with JavaScript enabled will be able to use the AJAX functionality, and those without JavaScript support will be able to follow the link regardless of the script. Consider an example.
a href="ajax.htm?foo=32" onClick="navigate('ajax.html#foo=32');
return false">foo 32

P
Peter, 2017-02-10
@petermzg

Search robots do not execute javascript. What is on the page without js will be indexed, otherwise not.

M
Maxim Timofeev, 2017-02-10
@webinar

The site has approximately 1000 characters.
is it on the whole site?
Interested in whether it will be correct to use javascript to implement multilingualism
How is the use of a particular technology related to the number of characters?
how will google react to this
What for? Why do you have a small site? Or why is it multilingual? Or in javascript?

I
Ivan, 2017-02-10
@LiguidCool

The correct answer is "don't." Again, meta tags indicating the language are not just invented.
Yes, and in the family you profit from such a crutch?

P
pavelblog, 2017-02-10
@pavelblog

In principle, you can replace the text depending on the language settings in the browser

<div id="login-form-form">
        <h2 class="b-title b-text b-text_lang_en">Welcome!</h2>
        <h2 class="b-title b-text b-text_lang_ru">Добро пожаловать!</h2>
    </div>
<script type="text/javascript">
  var platformLanguage = navigator && (
      navigator.language ||
        navigator.browserLanguage ||
        navigator.systemLanguage ||
        navigator.userLanguage ||
        null ),
    elemsRU, elemsEN;
  if (platformLanguage.match("ru") && document.getElementsByClassName) {
    elemsRU = document.getElementsByClassName("b-text_lang_ru");
    elemsEN = document.getElementsByClassName("b-text_lang_en");
    var l = elemsEN.length;
    while(l--) {
      elemsEN[l].style.display = "none";
    }
    l = elemsRU.length;
    while(l--) {
      elemsRU[l].style.display = "block";
    }
  }
</script>

M
M-ka, 2017-02-10
@M-ka

Write an English version of the site, put indexes next to all phrases and, when changing the language, load the desired localization and go through with autocorrect, and then use it from the desired localization when generating blocks. Another option is that initially there are no phrases, and the content is collected on the go.
With any of the options, start some kind of abstract lang into which the necessary localization is drawn in and correspondences are taken from it. When changing localization, re-saving the desired localization into an abstract lang bypassing all indices.
Well, these are such simple options .... More complex, write your own parser (well, or take a ready-made one), which will go through itself, put down indexes, submit somewhere with Ajax, will be written to the database, in which the necessary localizations are added to the indexes through which then a web muzzle ... In general, a huge flight of fancy.

K
kulaeff, 2017-02-10
@kulaeff

Well, the Google robot seems to have learned to more or less tolerably index sites drawn on the client. There is even a tool to check if the site is indexed or not. It's called Fetch as Google.

I
Immortal_pony, 2017-02-10
@Immortal_pony

i18next.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question