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

Topics: Localization, Writing modules
Apr 4, 2013 at 11:28 AM
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?
Apr 4, 2013 at 11:41 AM
For all Text strings you need to use @T("<Text Goes here>") Then you need to create a po file for your module


Apr 4, 2013 at 12:03 PM
thanks for the quick response
Apr 4, 2013 at 3: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 3: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!"