How to set language according to file . resx

Asked

Viewed 89 times

2

I am aware of the existence of this question:

Internationalization using ASP.Net MVC

but I’m having some questions. I have these language files (I’ll have more in the future):

inserir a descrição da imagem aqui

The system in question does not give any postback on the pages, so I have no way to change the text of the Abels in the backend. I am currently doing this with an AJAX call that fills an array of strings in javascript with the current language texts.

But it seems to me to be either a huge gambit, or extremely slow/succinct to problems.

Is there "the right way" to do this? What would be?

  • Let’s try again. Well, your application is a SPA then? Did you mean in the body of your question that no request is made to the server after the first upload? (Except by ajax, obviously)

  • It is not a SPA. But yes, pages only make Ajax requests (after loading). The first thing called on $(document).ready of each page is a method carrega_idioma, that makes an Ajax request by filling a huge array with the current language texts, if it gets confused, I edit the question with more explanations

  • But I think if it was a Single-page application the solution would be the same one I’m looking for :), so if you know something...

  • Well, if the app only has one page it’s a spa, it’s not?

  • But it doesn’t have only one page. It has several (seven or eight), and in each of them I make this request to load the language texts

  • So. And to get to these pages no requests are made to the server?

  • Yes, they are made

  • So why not use the files resx at the time of assembling these pages? In fact, tell me one thing: you speak in postback on the question, the system is really webforms? Or did you just use the term?

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.