如何在语言更改后翻译母版页中的内容页面(ASP.NET)

时间:2021-12-17 21:13:02

I have a content page in a master page in ASP.NET. What is going on is that the user click on a button in the right corner of the master page and that change the current language. What does the button is changing the Session for the new selected language.

我在ASP.NET的母版页中有一个内容页面。发生的事情是用户单击母版页右上角的按钮并更改当前语言。该按钮用于更改新选定语言的会话。

What is happening is that when you click on a button, the code is executed AFTER the Page_Load of both the master page and the content page is called. But in my button, I call a function "Translate" that do the translation of the master page.

发生的事情是,当您单击按钮时,代码将在调用母版页和内容页的Page_Load之后执行。但是在我的按钮中,我调用了一个功能“翻译”来完成母版页的翻译。

Unfortunately, I don't know what to do for the content page. I tried to do a manual reload of it but I don't know how.

不幸的是,我不知道如何处理内容页面。我试着手动重装它,但我不知道怎么做。

Is there anyone here that can help me? I don't think that code is needed here but if it can help you, just ask me what you need and I will update.

这里有人可以帮助我吗?我不认为这里需要代码,但如果它可以帮助你,只要问我你需要什么,我会更新。

Thanks

Jaff

1 个解决方案

#1


After changing the users language settings (both on the thread and where ever you persist that information too) do a Response.Redirect to the page they are already on. This allows for a clean page load and reduces the chance that other culture specific settings will cause a problem (such as date and time selections.)

更改用户语言设置后(在线程上以及您在哪里持久保存该信息)执行Response.Redirect到他们已经在的页面。这样可以实现干净的页面加载,并降低其他文化特定设置导致问题的可能性(例如日期和时间选择)。

#1


After changing the users language settings (both on the thread and where ever you persist that information too) do a Response.Redirect to the page they are already on. This allows for a clean page load and reduces the chance that other culture specific settings will cause a problem (such as date and time selections.)

更改用户语言设置后(在线程上以及您在哪里持久保存该信息)执行Response.Redirect到他们已经在的页面。这样可以实现干净的页面加载,并降低其他文化特定设置导致问题的可能性(例如日期和时间选择)。