Skip to content

Improve and update Localization docs and samples #23062

Closed
@Ponant

Description

@Ponant

I may suggest to drastically improve the localization docs.
I am happy to help, but I would like not to go through all versions of .Net Core, and rather focus on .Net 6.
I could do a video on youtube or wherever if that is acceptable on the site.
The strategy would be to first do the video and if you like it we transform it to text.
You can check out my tuto skills here https://www.youtube.com/watch?v=n5DI3VDtvAQ , and feel free to complain :)!
I have a better microphone.

Background: I worked on Localization in the past, so I knew it, but after 2-3 years I came back to Localization for a new project and somewhat needed a refresher. So I went back to the docs and found them somewhat dismanteled and not so in line with typical docs on asp.net core. It is a very confusing experience, going back and forth through the main page. I am sorry for this negative feedback.

Here is some feedback:
Sample
-The startup does not need to register RequestLocalizationOptions twice, once in services and once in app builder, see here https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/localization/sample/3.x/Localization/Startup.cs
-Update to Razor Pages or put in some sentence in the docs. For example I figured out on my own that I could do it, for example by using IndexModel as a type for IStringLocalizer. It was not difficult to guess but I believe if it was there in the docs, it would have been better

Main docs
In typical docs in this repo, the usage is to go straight with a basic configuration, i.e. AddLocalization, Configure RequestLocalizationOptions, UseRequestLocalization.

  1. Then run and observe via the query string how a date is displayed in a different culture (no need for resx files at this stage).
  2. Experience with fallbacks through the providers (Query, cookie and accept header)
  3. Then move on to add resx files, by highlighting IStringLocalizer, IHtmlLocalizer, IViewLocalizer, data annotations
  4. In that respect I find it important to mention that you can use IStringLocalizer in views and stick with that only. The other two are for html based strings
  5. Then cookie
  6. Then of course go to higher levels by tweaking the providers and mentionning the factory
  7. etc

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions