Configuration Settings

Both the ASP.NET Core and ASP.NET 4.x versions of Westwind.Globalization use a common configuration object to allow configuration of the provider.

The main difference between the two is how they are configured and you can find more on that in the Installation Topics.

For reference here are the common configuration formats:

.NET Core
// DbResourceConfiguration.json
{
  "ResourceAccessMode": "DbResourceManager",
  "ConnectionString": "server=.;database=localizations;integrated security=true;",
  "DataProvider": "SqlServer",
  "ResourceTableName": "Localizations",
  "ResxExportProjectType": "Project",
  "ResxBaseFolder": "~/Properties/",
  "StronglyTypedGlobalResource": "~/Properties/Resources.cs",
  "ResourceBaseNamespace": "AppResources",
  "AddMissingResources": true,
  "LocalizationFormWebPath": "~/LocalizationAdmin/",
  "GoogleApiKey": "XXXfaSyDcvmGhGN7FlynP9QUZOLF8_4K8iF9ChWo",
  "BingClientId": "12345-4b99-47ed-be7e-caf733526020"
}
Full Framework
<configuration>
  <configSections>
    <section name="DbResourceConfiguration" requirePermission="false" 
			 type="System.Configuration.NameValueSectionHandler,System,Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>  

  <DbResourceConfiguration>
    <add key="ConnectionString" value="server=.;database=Localizations;integrated security=true;" />
    <add key="DataProvider" value="SqlServer" />
    <add key="ResourceTableName" value="Localizations" />
    <add key="AddMissingResources" value="False" />

    <!-- Resource Imports and Exports -->
    <add key="ResxExportProjectType" value="Project" />
    <add key="StronglyTypedGlobalResource" value="~/Properties/Resources.cs" />
    <add key="ResourceBaseNamespace" value="WebApplication1.Properties" />    
    <add key="ResxBaseFolder" value="~/Properties" />

    <!-- Google Translate API -->
    <add key="GoogleApiKey" value="" />

    <!-- Bing Translation -->
    <add key="BingClientId" value="" />
  </DbResourceConfiguration>

  <!-- Enable ASP.NET Resource Provider  -->
  <system.web>
    <globalization resourceProviderFactoryType=
     "Westwind.Globalization.DbSimpleResourceProviderFactory,Westwind.Globalization.Web" />
  </system.web>
</configuration>

Configuration Settings

  • DataProvider
    This setting specifies the provider name that is to be used. Available default values are SqlServer, MySql, SqLite and SqlServerCompact.

  • ConnectionString and ResourceTableName
    The two most important keys are the ConnectionString and ResourceTableName which point at your database and a table that holds resources. On full framework you can use either a raw connection string or a Connection String Name defined in <ConnectionStrings> of your web.config file. On .NET Core only raw connection strings can be used.

  • AddMissingResources
    When set to true causes any resource lookup that fails to produce matching resource ID to write the invariant resource into the database. Use with caution - as this might slow down your application significantly as you now write to the database on any missing resources. Use only during development and testing to get resources into the system for easier debugging later.

  • ResxExportProjectType
    This option determines how the Resx export feature works. The two options are Project or WebForms. Project exports all resource files into \Properties folder underneath the resxBasePath and excludes any resource sets that include a . in their name (assumed to be ASP.NET resources). WebForms writes out resources into folder specific App_LocalResources and App_GlobalResources folders based on the root folder

  • ResxBaseFolder
    The base folder that's used for all Resx Import and Export operations. The default is ~/ which is the root web folder, but you can specify a full OS path here. Note that this allows you to read/write resources in other non-web projects - as long as your Web application has writes to the folder specified.

  • StronglyTypeGlobalResource and ResourceBaseNamespace If you do a strongly typed class export from the admin manager all resources will be created in a single file in the this file using the ResourceBaseNameSpace as the namespace in the generated class.

  • LocalizationFormWebPath
    Specifies the location of the Localization Admin form. This is used for embedding resource links that allow editing of resources.

  • Translation API Keys
    These keys are required for localization of resources using the translate dialog on the Admin form. Google API is currently not required, but in order to use Bing you will need to sign up for a Bing Translate API Client id.


© West Wind Technologies, 2006 - 2019 • Updated: 01/24/18
Comment or report problem with topic