This project is read-only.

Localizer has problem for getting localized text when there are some arguments.

Topics: Core, Customizing Orchard, General, Localization, Writing modules, Writing themes
Aug 9, 2014 at 10:06 AM
Edited Aug 9, 2014 at 10:08 AM
When you override a template, one sub localization scope will be created that it will fall back to main localization scope if there is no translation is sub scope.
for example if you override Register.cshtml in your theme T must fall back to T in Orchard.Users if you don't have PO file in theme for it.
But i think the condition for this fallback is wrong and causes bug when there is argument in text.
Bug is in Orchard\Mvc\ViewEngines\Razor\WebViewPage.cs
if(hint.Text != text) {
    return hint;
For example for:
T("Passwords are required to be a minimum of {0} characters in length.", ViewData["PasswordLength"])
we need to fall back to Orchard.Users but condition prevents becuase:
"Passwords are required to be a minimum of {0} characters in length." 
is not equal to
"Passwords are required to be a minimum of 7 characters in length."
therefore it returns later as translation but it is the original text not translation.
This problem occurs only when text has parameters.

I think the condition must be:
if(hint.Text != string.Format(text, args)) {
    return hint;
Aug 10, 2014 at 9:20 AM
Interesting. Can you please create an issue so we can triage? Thanks
Aug 10, 2014 at 11:52 AM
Sure. I will create it as soon as possible.
Aug 11, 2014 at 5:43 AM
Edited Aug 11, 2014 at 5:44 AM
I create the related issue. Thank you for your notice.
Aug 11, 2014 at 7:47 AM
Great, thank you.