Base solution for your next web application
Open Closed

Localization in Sample App #6829


User avatar
0
gconey created

Hi,

I don't understand this in the Angular sample app (e.g. in "Creating the PhoneBook Component" and on many other pages of the sample App): {{l("PhoneBook" | localize)}}

Why use the l() function and the localize pipe? Surely they are two different ways of doing the same thing and don't need to be used together? There is also an example of this in the framework in "theme-selection-panel.component.html" Also can you explain the difference between the two methods of localization? Why did you introduce the pipe? Should I change my app to use the pipe method everywhere?

Thanks.


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    This is a mistake in the documentation, I will update it. You can use the localize pipeline directly.

  • User Avatar
    0
    maliming created
    Support Team

    https://github.com/aspnetzero/documents/pull/135

  • User Avatar
    0
    gconey created

    Thanks. There is also an example of this in the framework in "theme-selection-panel.component.html" Also can you explain the difference between the two methods of localization? Why did you introduce the pipe? Should I change my app to use the pipe method everywhere?

  • User Avatar
    0
    maliming created
    Support Team

    https://github.com/aspnetzero/aspnet-zero-core/commit/cd01dd93178a82b807a32f26beb78e7169686356 already fixed

    The zero angular localize pipeline is used more.

  • User Avatar
    1
    aaron created
    Support Team

    Also can you explain the difference between the two methods of localization? Why did you introduce the pipe?

    localize pipe was introduced to prevent calling localization every time Angular runs change detection, possibly [on] every mouse move on the container component.

    See aspnetzero/aspnet-zero-core#2001.

    Should I change my app to use the pipe method everywhere?

    Yes, it is recommended.