What needs to be done for my custom module to support other languages?

Topics: Localization, Writing modules
Apr 4, 2013 at 12:28 PM
Hi, I have created a custom module which needs to be available in other languages as well. Can you please give me some directions how I can proceed?
Developer
Apr 4, 2013 at 12:41 PM
For all Text strings you need to use @T("<Text Goes here>") Then you need to create a po file for your module

http://orchardproject.net/localize
http://docs.orchardproject.net/Documentation/Creating-global-ready-applications

Nick
Apr 4, 2013 at 1:03 PM
thanks for the quick response
Apr 4, 2013 at 4:21 PM
I have managed to create the .po file for en-US, and use it for inside my views like @T("FirstName") and its working. But I have a problem when I am calling it inside the controller.
class TestController(){
    public Localizer T { get; set; }

    public TestController(){T = NullLocalizer.Instance;}

    public ActionResult Index(){
        ModelState.AddModelError("FNameError", T("FirstName").Text);
        return View();
    }
}
Apr 4, 2013 at 4:33 PM
Ok, I found the issue, was in .po file. I set the path like #: ~/Modules/MyModule/Controllers/TestController__.cs which is wrong.

The correct way is:

#: MyModule.Controllers.TestController
msgid "eMsg_EmailDoNotExists"
msgstr "Email address is not listed in our database!"