1. \r\n<\/body>\r\n<\/html><\/pre>

      Then in ASP.NET Core Web Create the Resources folder in the project, add the Views.Shared._Layout.en-Us.resx and Views.Shared._Layout.zh-CN.resx files, the Views.Shared._Layout.resx file respectively, and add \"SiteTitle\" The corresponding statement text: <\/p>\n

      1) Views.Shared._Layout.en-Us.resx<\/p>\n

      \"\"<\/p>##2) Views.Shared._Layout.zh- CN.resx

      <\/p>\n

      \"\"<\/p>#When running the ASP.NET Core site, it will be based on the browser's language setting (Accept-Language header), or culture query parameters, or .AspNetCore .Culture Cookie value displays the text of the corresponding language:

      <\/p>\n

      \"\"<\/p>\n

      \"\"<\/p># Things to note: Never add Views without a language name. Shared._Layout.en-Us.resx, otherwise you will encounter \"Custom tool ResXFileCodeGenerator failed to produce an output for input file ... but did not log a specific error.\" when adding a .resx file with a code language name. Question

      <\/p>"}

      国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

      Home Backend Development C#.Net Tutorial Detailed introduction to multi-language support in ASP.NET Core

      Detailed introduction to multi-language support in ASP.NET Core

      Sep 01, 2017 pm 02:23 PM
      asp.net core language

      This article mainly introduces the multi-language support (Localization) in ASP.NET Core, which has certain reference value. Those who are interested can learn about it

      First add AddLocalization and AddViewLocalization in ConfigureServices of Startup And configure RequestLocalizationOptions (assuming English and Chinese are used here):


      public void ConfigureServices(IServiceCollection services)
      {
        services.AddLocalization(options => options.ResourcesPath = "Resources");
      
        services.AddMvc()
          .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix);
      
        services.Configure<RequestLocalizationOptions>(
          opts =>
          {
            var supportedCultures = new List<CultureInfo>
            {
              new CultureInfo("en-US"),
              new CultureInfo("zh-CN")
            };
            opts.SupportedCultures = supportedCultures;
            opts.SupportedUICultures = supportedCultures;
          });
      }

      Apply RequestLocalizationOptions in the Configure() method of Startup:


      var requestLocalizationOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>().Value;
      app.UseRequestLocalization(requestLocalizationOptions);

      Then display the suffix of the page title in a multi-lingual manner through the IViewLocalizer interface in the _Layout.cshtml view:


      @using Microsoft.AspNetCore.Mvc.Localization
      @inject IViewLocalizer Localizer
      <!DOCTYPE html>
      <html>
      <head>
        <title>@ViewData["Title"] - @Localizer["SiteTitle"]</title>
      </head>
      <body>
      </body>
      </html>

      Then in ASP.NET Core Web Create the Resources folder in the project, add the Views.Shared._Layout.en-Us.resx and Views.Shared._Layout.zh-CN.resx files, the Views.Shared._Layout.resx file respectively, and add "SiteTitle" The corresponding statement text:

      1) Views.Shared._Layout.en-Us.resx

      ##2) Views.Shared._Layout.zh- CN.resx

      #When running the ASP.NET Core site, it will be based on the browser's language setting (Accept-Language header), or culture query parameters, or .AspNetCore .Culture Cookie value displays the text of the corresponding language:

      # Things to note: Never add Views without a language name. Shared._Layout.en-Us.resx, otherwise you will encounter "Custom tool ResXFileCodeGenerator failed to produce an output for input file ... but did not log a specific error." when adding a .resx file with a code language name. Question

      The above is the detailed content of Detailed introduction to multi-language support in ASP.NET Core. For more information, please follow other related articles on the PHP Chinese website!

      Statement of this Website
      The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

      Hot AI Tools

      Undress AI Tool

      Undress AI Tool

      Undress images for free

      Undresser.AI Undress

      Undresser.AI Undress

      AI-powered app for creating realistic nude photos

      AI Clothes Remover

      AI Clothes Remover

      Online AI tool for removing clothes from photos.

      Clothoff.io

      Clothoff.io

      AI clothes remover

      Video Face Swap

      Video Face Swap

      Swap faces in any video effortlessly with our completely free AI face swap tool!

      Hot Tools

      Notepad++7.3.1

      Notepad++7.3.1

      Easy-to-use and free code editor

      SublimeText3 Chinese version

      SublimeText3 Chinese version

      Chinese version, very easy to use

      Zend Studio 13.0.1

      Zend Studio 13.0.1

      Powerful PHP integrated development environment

      Dreamweaver CS6

      Dreamweaver CS6

      Visual web development tools

      SublimeText3 Mac version

      SublimeText3 Mac version

      God-level code editing software (SublimeText3)

      How to Completely Remove Unwanted Display Languages ??on Windows 11 How to Completely Remove Unwanted Display Languages ??on Windows 11 Sep 24, 2023 pm 04:25 PM

      Work on the same setup for too long or share your PC with others. You may have some language packs installed, which often create conflicts. So, it’s time to remove unwanted display languages ??in Windows 11. Speaking of conflicts, when there are multiple language packs, inadvertently pressing Ctrl+Shift changes the keyboard layout. If not taken care of, this can be a hindrance to the task at hand. So, let’s jump right into the method! How to remove display language from Windows 11? 1. From Settings press + to open the Settings app, go to Time & Language from the navigation pane and click on Language & Region. WindowsI click the ellipsis next to the display language you want to remove and select Remove from the pop-up menu. Click "

      How to enable Core Isolation's memory integrity feature in Windows 11 How to enable Core Isolation's memory integrity feature in Windows 11 May 10, 2023 pm 11:49 PM

      Microsoft's Windows 11 2022 Update (22H2) enables CoreIsolation's memory integrity protection by default. However, if you are running an older version of the operating system, such as Windows 11 2022 Update (22H1), you will need to turn this feature on manually. Turn on CoreIsolation's Memory Integrity feature in Windows 11 For users who don't know about Core Isolation, it's a security process designed to protect basic core activities on Windows from malicious programs by isolating them in memory. This process, combined with the memory integrity feature, ensures

      3 Ways to Change Language on iPhone 3 Ways to Change Language on iPhone Feb 02, 2024 pm 04:12 PM

      It's no secret that the iPhone is one of the most user-friendly electronic gadgets, and one of the reasons why is that it can be easily personalized to your liking. In Personalization, you can change the language to a different language than the one you selected when setting up your iPhone. If you're familiar with multiple languages, or your iPhone's language setting is wrong, you can change it as we explain below. How to Change the Language of iPhone [3 Methods] iOS allows users to freely switch the preferred language on iPhone to adapt to different needs. You can change the language of interaction with Siri to facilitate communication with the voice assistant. At the same time, when using the local keyboard, you can easily switch between multiple languages ??to improve input efficiency.

      Fix: Alt + Shift doesn't change language on Windows 11 Fix: Alt + Shift doesn't change language on Windows 11 Oct 11, 2023 pm 02:17 PM

      While Alt+Shift doesn't change the language on Windows 11, you can use Win+Spacebar to get the same effect. Also, make sure to use the left Alt+Shift and not the ones on the right side of the keyboard. Why can't Alt+Shift change the language? You have no more languages ??to choose from. Input language hotkeys have been changed. A bug in the latest Windows update prevents you from changing your keyboard language. Uninstall the latest updates to resolve this issue. You are in the active window of an application that uses the same hotkeys to perform other actions. How do you use AltShift to change the language on Windows 11? 1. Use the correct key sequence First, make sure you are using the correct method of using the + combination.

      Adding comprehensive audio-visual capabilities to large language models, DAMO Academy opens source Video-LLaMA Adding comprehensive audio-visual capabilities to large language models, DAMO Academy opens source Video-LLaMA Jun 09, 2023 pm 09:28 PM

      Video plays an increasingly important role in today's social media and Internet culture. Douyin, Kuaishou, Bilibili, etc. have become popular platforms for hundreds of millions of users. Users share their life moments, creative works, interesting moments and other content around videos to interact and communicate with others. Recently, large language models have demonstrated impressive capabilities. Can we equip large models with "eyes" and "ears" so that they can understand videos and interact with users? Starting from this problem, researchers from DAMO Academy proposed Video-LLaMA, a large model with comprehensive audio-visual capabilities. Video-LLaMA can perceive and understand the video and audio signals in the video, and can understand the instructions input by the user to complete a series of complex tasks based on audio and video,

      How to set the language of Win10 computer to Chinese? How to set the language of Win10 computer to Chinese? Jan 05, 2024 pm 06:51 PM

      Sometimes we just install the computer system and find that the system is in English. In this case, we need to change the computer language to Chinese. So how to change the computer language to Chinese in the win10 system? Now Give you specific operation methods. How to change the computer language in win10 to Chinese 1. Turn on the computer and click the start button in the lower left corner. 2. Click the settings option on the left. 3. Select "Time and Language" on the page that opens. 4. After opening, click "Language" on the left. 5. Here you can set the computer language you want.

      You can play Genshin Impact just by moving your mouth! Use AI to switch characters and attack enemies. Netizen: 'Ayaka, use Kamiri-ryu Frost Destruction' You can play Genshin Impact just by moving your mouth! Use AI to switch characters and attack enemies. Netizen: 'Ayaka, use Kamiri-ryu Frost Destruction' May 13, 2023 pm 07:52 PM

      When it comes to domestic games that have become popular all over the world in the past two years, Genshin Impact definitely takes the cake. According to this year’s Q1 quarter mobile game revenue survey report released in May, “Genshin Impact” firmly won the first place among card-drawing mobile games with an absolute advantage of 567 million U.S. dollars. This also announced that “Genshin Impact” has been online in just 18 years. A few months later, total revenue from the mobile platform alone exceeded US$3 billion (approximately RM13 billion). Now, the last 2.8 island version before the opening of Xumi is long overdue. After a long draft period, there are finally new plots and areas to play. But I don’t know how many “Liver Emperors” there are. Now that the island has been fully explored, grass has begun to grow again. There are a total of 182 treasure chests + 1 Mora box (not included). There is no need to worry about the long grass period. The Genshin Impact area is never short of work. No, during the long grass

      Exploring the boundaries of agents: AgentQuest, a modular benchmark framework for comprehensively measuring and improving the performance of large language model agents Exploring the boundaries of agents: AgentQuest, a modular benchmark framework for comprehensively measuring and improving the performance of large language model agents Apr 11, 2024 pm 08:52 PM

      Based on the continuous optimization of large models, LLM agents - these powerful algorithmic entities have shown the potential to solve complex multi-step reasoning tasks. From natural language processing to deep learning, LLM agents are gradually becoming the focus of research and industry. They can not only understand and generate human language, but also formulate strategies, perform tasks in diverse environments, and even use API calls and coding to Build solutions. In this context, the introduction of the AgentQuest framework is a milestone. It not only provides a modular benchmarking platform for the evaluation and advancement of LLM agents, but also provides researchers with a Powerful tools to track and improve the performance of these agents at a more granular level

      See all articles