@T() method

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 12 años
Hi...
I'm learning how nopCommerce was written.
I would like to know where @T(), that is used on the views, is definied?

Thanks
Hace 12 años
you can right click on it in visual studio->go to definition

or its at nop.web.framework.viewengines.razor.webviewpage<tmodel>
Hace 12 años
It's defined in Nop.Web.Framework.ViewEngines.Razor.WebViewPage.

You can also open Nop.Web/Views/web.config, page base type is configured there:


  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="Nop.Web.Framework.ViewEngines.Razor.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="Nop.Web.Framework.UI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>
Hace 12 años
Thank you both for helping me!
Hace 10 años
Hello All,

I have one problem woth @t() method . i am created @t() which is access on my layour page & index page but it's not access other page so can you give any idea for all page

Thanks
Hace 9 años
As suggested when I tried to right click on it in visual studio 2012 in .cshtml pages, Option “go to definition” was missing. Then I have to see the definition of some other object but Option “go to definition” was also missing for them as well.
So can anyone tell me why Option “go to definition” is missing?

For example i want to see the Definition of the Manage

<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-catalog.png")" alt="" />
        @T("Admin.Catalog.Categories.Manage") @Html.ActionLink("(" + T("Admin.Catalog.Categories.SwitchToTreeView") + ")", "Tree")
    </div>
Hace 9 años
Hello,

not being an mvc/razor/helper/localization expert, I am learning nopCommerce also.

I would like to know the purpose of "@T".  Does it simply display something?

What does "@T("Account.Administration")" do?  What is "Account.Administration"?

Does the "T" stand for text?

Any help would be gratefully appreciated.

Thanks,
Tony
Hace 9 años
@T() gets the localized text.  (Language string resource for the current language)
Hace 9 años
New York wrote:
@T() gets the localized text.  (Language string resource for the current language)


Thanks New York.

I'm starting to get it now.

I used the debugger to follow this code "@T("Account.Administration")".  It opened Nop.Web.Framework\ViewEngines\Razor\ViewWebPage.cs which returned the value "Administration" for the "LocaleResource Name="Account.Administration""

I believe it gets that from the Nop.Web\App_Data\Localization\defaultResources.nopres.xml file.

Thanks,
Tony
Hace 9 años
The xml file is only used during installation.  The DB table LocaleStringResource is where the resources are, and you can add/modify them using Admin > Configuration > Languages >> View string resources
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.