@T() method

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

Thanks
12 anni tempo fa
you can right click on it in visual studio->go to definition

or its at nop.web.framework.viewengines.razor.webviewpage<tmodel>
12 anni tempo fa
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>
12 anni tempo fa
Thank you both for helping me!
10 anni tempo fa
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
9 anni tempo fa
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>
9 anni tempo fa
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
9 anni tempo fa
@T() gets the localized text.  (Language string resource for the current language)
9 anni tempo fa
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
9 anni tempo fa
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.