🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

Westwind.Globalization.Web.Starter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Westwind.Globalization.Web.Starter

This project is the Web Starter project for Westwind.Globalization.Web. It includes a few sample resources you can use to verify that the dbResource provider is working and allows you to play with a sample page. It's recommended you start with this .Starter NuGet package - you can remove it after you are up and running. This library provides the ASP.NET specific components to the Westwind.Globalization library. It contains the ASP.NET Resource Providers (DbResourceSimpleProvider, DbResourceProvider), the JavaScript Resource Handler to serve ASP.NET resources to JavaScript client, the on-line Resource editor to allow editing of data resources in real time. This library also provides the integration with WebForms using the resource control and dynamic icons. This library is required for using Westwind.Globalization in most ASP.NET Web Projects. MVC projects can safely remove the Westwind.Web.Forms assembly from the distribution.

3.1.2
Source
NuGet
Version published
Maintainers
1
Created
Source
<link rel="shortcut icon" href="localizationAdmin\favicon.ico" type="image/x-icon" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
 <![endif]-->

<title>DbResourceManager Test Page</title>

<link href="localizationAdmin/bower_components/bootstrap/dist/css/bootstrap.min.css"
      rel="stylesheet" />
<link href="localizationAdmin/bower_components/fontawesome/css/font-awesome.min.css"
      rel="stylesheet" />

<link href="localizationAdmin/css/localizationAdmin.css" rel="stylesheet" />
<style>
    label {
        display: block;
        margin-top: 10px;
        margin-bottom: 0;
    }

    hr {
        margin: 10px 0 -10px;
    }
    pre { word-wrap: normal;}
    nav a { color: white;}
</style>
<!--<script src="LocalizationAdmin/bower_components/jquery/dist/jquery.min.js"></script>-->
West Wind Globalization
Westwind Globalization Configuration
<nav class="menubar " style="background: #727272;">
    <ul id="MenuButtons" class="nav navbar-nav pull-right navbar">
        <li>
            <a href="localizationAdmin/">
                <i class="fa fa-gears"></i> Resource Editor
            </a>
        </li>
        <li>
            <a href="resourcetest.aspx">
                <i class="fa fa-check-circle"></i> Provider Test Page
            </a>
        </li>
        <li>
            <a href="https://github.com/RickStrahl/Westwind.Globalization"><i class="fa fa-github"></i> Github</a>
        </li>
        <li>
            <a href="https://www.nuget.org/packages?q=westwind.globalization"><i class="fa fa-stop"></i> Nuget</a>
        </li>
        <li>
            <a href="./"><i class="fa fa-home"></i></a>
        </li>

    </ul>
    <div class="clearfix"></div>
</nav>
<article class="contentcontainer" style="margin: 30px; margin-top: 2px; padding-top: 0px;">
    <h3>West Wind Globalization Configuration</h3>
    <p>
        The NuGet package installs all the required assemblies and configures most
        web.config configuration settings. The only required setting you have to set
        initially is the ConnectionString in the configuration.
    </p>
    <p>
        The following settings should be made automatically when you install with the NuGet
        package:
    </p>

    <pre>&lt;configsections&gt;

<section name="DbResourceConfiguration" type="System.Configuration.NameValueSectionHandler,System,Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirepermission="false" /> </configsections> <DbResourceConfiguration> <add key="ConnectionString" value="*** Your ConnectionString or ConnectionStrings Entry here ***" /> <add key="ResourceTableName" value="Localizations" /> <add key="StronglyTypedGlobalResource" value="/Properties/Resources.cs" /> <add key="ResourceBaseNamespace" value="AppResources" /> <add key="ResxExportProjectType" value="Project" /> <add key="ResxBaseFolder" value="/" /> <add key="AddMissingResources" value="True" /> <add key="LocalizationFormWebPath" value="~/LocalizationAdmin/" /> <add key="BingClientId" value="" /> <add key="BingClientSecret" value="" />
</DbResourceConfiguration>

    <p>
        Manually edit the connection string that points at the database that will contain the
        localization table. You can use a full connection string or a connection string entry
        from your .config file. This table will be auto-created for you when the globalization resources
        are accessed or you are running the localization admin form. Please make sure that the database
        has appropriate rights to create a table.
    </p>
    <p><a href="https://github.com/RickStrahl/Westwind.Globalization#configuration-settings">More configuration information...</a></p>


    <h3>Resource Provider is enabled by default</h3>
    <p>
        Once the NuGet package has been installed the provider is immediately enabled with:
    </p>

    <pre>&lt;globalization resourceproviderfactorytype=&quot;Westwind.Globalization.DbSimpleResourceProviderFactory,Westwind.Globalization&quot; /&gt;</pre>

    <p>
        If you are currently using Resx resources this will cause your resources to fail and if so you'll
        want to comment the line above in web.config and first import resources into the resource table. Once
        imported you can then turn on the new resource provider by uncommenting the line again.
    </p>

    <h3>Providers other than SQL Server</h3>
    <p>
        If you're using SQL Server you don't need to add anything - the SQL Server provider is included in the core Westwind.Globalization package.
        If you want to use MySql, SqLite or SqlServerCompact you have to install the specific provider package from NuGet.
    </p>
    <p>
        <a href="https://www.nuget.org/packages?q=westwind.globalization">Go to NuGet Westwind.Globalization Packages...</a>
    </p>
    <p>
        In addition you have to add a code based configuration setting to enable the specific DbResource provider with code as
        follows:
protected void Application_Start()
{
        DbResourceConfiguration.Current.ConnectionString = "MySqlLocalizations";
        DbResourceConfiguration.Current.DbResourceDataManagerType = typeof(DbResourceMySqlDataManager);
}
        <h3>Web Site Projects Localization Adminformtweaks</h3>
    <p>
        If your project is a <b>Web Site Project</b> rather than a <b>Web Application Project</b>
        in Visual Studio the localization admin form will fail. In order to make it work please edit the
        LocalizationService.ashx file as follows:

        <ul>
            <li>Delete the LocalizationService.ashx file</li>
            <li>Rename the LocalizationService.ashx.cs file to LocalizationService.ashx</li>
            <li>
                Change the header of the page as follows:
                <pre>&lt;%@ WebHandler Language=&quot;C#&quot; Class=&quot;LocalizationService&quot; %&gt;</pre>
            </li>
            <li>Remove the namespace around the LocalizationService class</li>
        </ul>
    </p>



    <h3>Getting Started with Localization</h3>

    <h4>Set up your Localization Database</h4>
    <ul>
        <li>Recompile your application and make sure there are no errors</li>
        <li>Make sure the connection string is set in the config file and your Web app has permissions to create a table</li>
        <li>Navigate to ./LocalizationAdmin/</li>
        <li>You should get an error that the table doesn't exist</li>
        <li>Use the <b>Create Table</b> button to create the resource table in the database</li>
        <li>Start adding/editing resources</li>
    </ul>

    <h4>If you have existing ResX Resources</h4>
    <ul>
        <li>Go to the Localization Admin Form</li>
        <li>Import resources from your Web project</li>
        <li>Edit your existing resources</li>
        <li>
            When done editing you can write them back out using the Export feature<br />
            <small> * please read the documentation for more info on how resources are exported - you may end up with a different format than you started with</small>
        </li>
    </ul>

    <h4>To create new Resources</h4>
    <p>
        To add new resources simply add a new resource by clicking the button underneath the
        resource items. The Add Resource button lets you create new resources for an existing
        resource set or create a new resource set as part of the update. Either of the Add
        bring up this same form. Simply create a new resource and if desired add a new resource
        set name to create the resource with a new resource set.
    </p>
    <p>
        In WebForms projects you can also create **Local Resources** which are bound to ASPX
        pages typically. Local resources can be used in Web Forms using the Resource Binding
        syntax available there. Local resources are named by their full path (ie. relativePath/Page.aspx)
        and with a file extension. All resources with a file extension are assumed to be local resources
        (when exporting in a WebForms project and ignored in Project mode).
    </p>
    <p>
        You can also create Resources implicitly simply by adding a new resource and specifying a
        new Resource name in the Add Resource form. Simply specify the language, Resource Id,
        localized text and the Resource name and that effectively creates a new ResourceSet.
    </p>

    <div class="notebox">
        <b>New Resource Sets or new Language Resources require a Page Refresh</b><br />
        The LocalizationAdmin form uses inline AJAX requests for quick updates, but when adding a new resource set or
        resource item with a new language you have to press the Refresh Page button to see the
        new resource set and language show up in the dialog. The Resources and Language lists
        do not dynamically update when items are saved, so a manual refresh is required.
    </div>

    <p>
        Note this resource editing scheme works for any resources and type of project including
        MVC projects with raw RESX files.
    </p>


</article>

Keywords

Localization

FAQs

Package last updated on 01 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts