Code Monkey home page Code Monkey logo

localization-provider-opti's Introduction

Quality Gate Status

Supporting Localization Provider

If you find this library useful, cup of coffee would be awesome! You can support further development of the library via Paypal.

Localization Provider v8.0 IS OUT!

Read more about v8.0 release here.

What is the LocalizationProvider project?

LocalizationProvider project is Optimizely localization provider on steroids.

Giving you the main following features:

  • Database-driven localization provider for Optimizely website projects
  • Easy resource registrations via code (code-first approach)
  • Supports hierarchical resource organization (with the help of child classes)
  • Administration UI for editors to change or add new translations for required languages

Getting Started

Working with DbLocalizationProvider

  • For more info about generic localization provider features read more here

Integrating with Optimizely

How to Contribute

It's super cool if you read this section and are interested how to help the library. Forking and playing around sample application is the fastest way to understand how the localization provider is working and how to get started.

Forking and cloning the repo is the first step you do. Keep in mind that the provider is split into couple of repositories to keep things separated. Additional repos are pulled in as submodules. If you Git client does not support automatic checkout of the submodules, just execute this command at the root of the checkout directory:

git clone --recurse-submodules [email protected]:valdisiljuconoks/localization-provider-epi.git

NB! As Optimizely repository contains 2 level (lib/netcore and lib/netcore/lib/localization-provider) submodules --recursive-submodules sometimes fails to detect 2nd level module. Then you can just step into netcore submodule folder and execute pull command there:

git submodule foreach git pull origin master

Other Versions

v7.0 is OUT

Please read more in this blog post!

Migrating from v5.x?

Please visit blog post to get more information about new features added in v6 and also how to migrate.

More Info

localization-provider-opti's People

Contributors

dependabot[bot] avatar fhogberg avatar mattisolsson avatar mend-bolt-for-github[bot] avatar valdisiljuconoks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

localization-provider-opti's Issues

Fallback to invariant even if resource is defined as an empty string

Hi,

It has been a while since our testers found something :-)

I am using Fallback to invariant setting:
ctx.EnableInvariantCultureFallback = true;

If I have a resource where there are the following translations:
invariant: "English translation"
"en": "English translation"
"de": ""

(the user set the translation to empty in the translation dialog in Admin UI without using the delete Button. So there is a translation in database, but it is empty)

If I get the translation for "de", I get the invariant translation (as fallback) instead of my expectation of "".

My suspection is that this behavior is controlled by a string.IsNullOrEmpty check in EPiServerGetTranslation.Execute()
(I would expect that fallback will be fetched only if a particular resource does not exist at all)

Issue can occur for instance when a developer creates a new resource with a beautiful text, then the resource editor thinks nothing should be displayed there at all and clears all translations. Invariant will be left over with my current settings, it is also not visible in AdminUI.
We also need fallback to invariant as not always all languages are translated (but in these cases there are null instead of "").

Thanks in advance!

CVE-2018-20677 (Medium) detected in bootstrap-3.0.0.min.js

CVE-2018-20677 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.0.0.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/js/bootstrap.min.js

Path to vulnerable library: /tests/DbLocalizationProvider.EPiServer.Sample/modules/_protected/DbLocalizationProvider.AdminUI.EPiServer/ClientResources/bootstrap.min.js

Dependency Hierarchy:

  • bootstrap-3.0.0.min.js (Vulnerable Library)

Found in HEAD commit: d8354fd8bce4d052c67f5a0aa51b5a113b99b712

Found in base branch: main

Vulnerability Details

In Bootstrap before 3.4.0, XSS is possible in the affix configuration target property.

Publish Date: 2019-01-09

URL: CVE-2018-20677

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-20677

Release Date: 2019-01-09

Fix Resolution: Bootstrap - v3.4.0;NorDroN.AngularTemplate - 0.1.6;Dynamic.NET.Express.ProjectTemplates - 0.8.0;dotnetng.template - 1.0.0.4;ZNxtApp.Core.Module.Theme - 1.0.9-Beta;JMeter - 5.0.0


Step up your Open Source Security Game with WhiteSource here

Admin UI isn’t translated.

Hi Valdis!

Great stuff, just tried it out and I really like it.
I did setup main plug-in, admin UI-plug-in and js/Ajax plug-in as instructed in documentation on a new EPi 11 site.

The admin UI isn’t translated, see screenshot:
14CA720B-8E66-475B-A007-D5F7CDD7B1B1

I wonder if it’s as simple as an extra space in an import-statement in view?

26498619-D5A0-4007-88C7-959DFD5BEE44

Or might I have missed something during install/setup?

Error [String or binary data would be truncated] on startup with new database

Hi Valdis!

A colleague of mine is deploying our solution on staging environment for the very first time.
We receive an SqlException caused by DbLocalizationProvider.

[SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +277
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +764
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4243
   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) +1344
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +420
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +391
   DbLocalizationProvider.Sync.<>c__DisplayClass4_0.<RegisterDiscoveredResources>b__2(IEnumerable`1 group) +2472
   System.Threading.Tasks.<>c__DisplayClass42_0`2.<PartitionerForEachWorker>b__1() +1639
   System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) +32
   System.Threading.Tasks.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object ) +272

[AggregateException: One or more errors occurred.]
   System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +4751668
   System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) +14351633
   System.Threading.Tasks.Parallel.PartitionerForEachWorker(Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) +1614
   System.Threading.Tasks.Parallel.ForEachWorker(IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) +525
   System.Threading.Tasks.Parallel.ForEach(IEnumerable`1 source, Action`1 body) +158
   DbLocalizationProvider.Sync.ResourceSynchronizer.RegisterDiscoveredResources(IEnumerable`1 types, IEnumerable`1 allResources) +370
   System.Threading.Tasks.Task.Execute() +70

[AggregateException: One or more errors occurred.]
   System.Threading.Tasks.Task.FastWaitAll(Task[] tasks) +4743220
   System.Threading.Tasks.Parallel.Invoke(ParallelOptions parallelOptions, Action[] actions) +2261
   DbLocalizationProvider.Sync.ResourceSynchronizer.DiscoverAndRegister() +975
   DbLocalizationProvider.EPiServer.DbLocalizationProviderInitializationModule.DiscoverAndRegister(Object sender, EventArgs eventArgs) +262

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128
   System.Delegate.DynamicInvokeImpl(Object[] args) +153
   EPiServer.Framework.Initialization.InitializationEngine.OnInitComplete() +236
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +208
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +423
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +225
   EPiServer.Global..ctor() +42
   ASP.global_asax..ctor() +9

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +139
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +105
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1431
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +184
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +27
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +182
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714
:hugging_face:

We have <episerver.framework createDatabaseSchema="true" updateDatabaseSchema="true"> in Web.config.

Do we need to create database before adding DbLocalizationProvider?

Site fails with read-only database mode

[SqlException (0x80131904): Failed to update database "mydatabasename" because the database is read-only.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +212
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +81
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +630
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4222
   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) +952
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +304
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +283
   DbLocalizationProvider.Sync.ResourceSynchronizer.ResetSyncStatus() +99
   DbLocalizationProvider.Sync.ResourceSynchronizer.DiscoverAndRegister() +613
   DbLocalizationProvider.EPiServer.DbLocalizationProviderInitializationModule.DiscoverAndRegister(Object sender, EventArgs eventArgs) +171

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +160
   System.Delegate.DynamicInvokeImpl(Object[] args) +117
   EPiServer.Framework.Initialization.InitializationEngine.OnInitComplete() +195
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +172
   EPiServer.Framework.Initialization.InitializationEngine.Initialize() +41
   EPiServer.Framework.Initialization.<>c.<FrameworkInitialization>b__7_0(InitializationEngine e) +14
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +338
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +140
   EPiServer.Global..ctor() +43
   Calamos.Web.EPiServerApplication..ctor() +10
   ASP.global_asax..ctor() +38

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +119
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1088
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +124
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +20
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +59
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +148
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +659
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189

JSON import creates NULL entries in database for IsModified=0 resources, then next startup fails with a NullReferenceException

Hi,

Me again :-)
Using version 5.6.0.
When having two resources with translation in "en" and "de" in database and doing an JSON import with a file with following contents:
-resource1 with new translation "nl"
-resource2 (which still has IsModified = 0 in database) with new translation "fr"

In preview shown correctly, that resource1 has "nl" as new change, resource2 has "fr" as new change. Let's accept both updates.

Now if we check in database, for resource2 (where IsModified was 0) a new LocalizationResourceTranslation for "nl" gets written, although there was no change there which seems very strange (problem nr. 1). Other changes are OK.

The problem is by next application startup, for some reason it detects a change and tries to do an update, but it throws a NullReferenceException in ResourceSynchronizer.AddTranslationScript() at line:
if (resourceTranslation.Value.Equals(resource.Translation))
because resourceTranslation.Value is null (problem nr. 2).

It happens only with new resources, so as a workaround we set IsModified to 1 for all resources, it seems to be working that way.

Could you look at this?
Is it possible to have some logging if something like this happens? On production we only have access to logs, not for servers.
Thanks!

DbLocalizationProvider.MigrationTool.5.4.0 throws FileLoadException at startup

I installed the DbLocalizationProvider.MigrationTool.5.4.0 from Episerver feed, at startup it crashes:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembl
y 'NDesk.Options, Version=0.2.1.0, Culture=neutral, PublicKeyToken=null' or one
of its dependencies. A strongly-named assembly is required. (Exception from HRES
ULT: 0x80131044)
at DbLocalizationProvider.MigrationTool.Program.Main(String[] args)

It seems to be that since version 5.0.0 the command line tool is signed, but the dependency NDesk.Options is not. I reverted to version 4.3.2, which is working fine.

Manually adding localization key with + sign results in wrong key

When manually (using UI) adding a new localization key with a "+" sign results in wrong key being added.
For example "Codes.A+B" results in "Codes.A B" (plus sign is interpreted as encoding).
Workaround is using "%2B" which is the URL encoded representation of the plus sign.

Used version: 5.8.0.

CVE-2018-14042 (Medium) detected in bootstrap-3.0.0.min.js

CVE-2018-14042 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.0.0.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/js/bootstrap.min.js

Path to vulnerable library: /tests/DbLocalizationProvider.EPiServer.Sample/modules/_protected/DbLocalizationProvider.AdminUI.EPiServer/ClientResources/bootstrap.min.js

Dependency Hierarchy:

  • bootstrap-3.0.0.min.js (Vulnerable Library)

Found in HEAD commit: d8354fd8bce4d052c67f5a0aa51b5a113b99b712

Found in base branch: main

Vulnerability Details

In Bootstrap before 4.1.2, XSS is possible in the data-container property of tooltip.

Publish Date: 2018-07-13

URL: CVE-2018-14042

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: twbs/bootstrap#26630

Release Date: 2018-07-13

Fix Resolution: org.webjars.npm:bootstrap:4.1.2.org.webjars:bootstrap:3.4.0


Step up your Open Source Security Game with WhiteSource here

Removing a localized label

Hi,

The localization provider works really well, but we have noticed something when using it to translate labels across multiple languages.
If you provide a localized string in a particular language, then decide you no longer want to localize, there is no way to revert the localized label in that particular language.
If you simply provide a null string, the translation of the label is saved in the DB, and the entry still remains, meaning the empty label is displayed on the site.
I'd have expected the tool to use the fallback language if the translation for a language was null.

If there any way to get this behavior to work as I would like?

Thanks very much,
Paul

JSON import of new resource not working

If I create a new resource in AdminUI on System A and I fill it in two languages, then I export in JSON, then I try to import on System B, it imports only in English. When importing, it does not even display the columns for the other language. In JSON file it seems to be correct:
{
"id": 1987,
"resourceKey": "/zsolttest",
"modificationDate": "2019-04-30T14:02:14.99Z",
"author": "_ext_zsoltne_adm",
"isModified": true,
"translations": [
{
"id": 16936,
"resourceId": 1987,
"language": "de",
"value": "new"
},
{
"id": 16937,
"resourceId": 1987,
"language": "en",
"value": "resource"
}
]
}

Package DbLocalizationProvider.AdminUI.EPiServer 5.5.1.

I cannot reproduce right now, but when I tried to export 2000 migrated resources on System A and tried to import it on System B, which was completely empty, there was no translations imported, only the resource entries themselves.

In both cases a workaround is to reimport the file and accept the "updates".
I am not sure if it has anything to do with legacy and migrated resources.

DbLocalizationProvider.AdminUI.EPiServer 5.4.0 XLIFF Export crash

When clicking on Export button the an exception is thrown.
The problem seems to be that DbLocalizationProvider.AdminUI.EPiServer.Xliff.dll is strongly named, but Xliff.OM is not signed.

Exception:
Could not load file or assembly 'Xliff.OM, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Xliff.OM, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FileLoadException: Could not load file or assembly 'Xliff.OM, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)]
DbLocalizationProvider.Xliff.Exporter.Export(ICollection1 resources, CultureInfo fromLanguage, CultureInfo toLanguage) +0 DbLocalizationProvider.Xliff.Exporter.Export(ICollection1 resources, NameValueCollection parameters) +166
DbLocalizationProvider.AdminUI.LocalizationResourcesController.ExportResources(String format) +104
lambda_method(Closure , ControllerBase , Object[] ) +104
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +157 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27
System.Web.Mvc.<>c__DisplayClass24_0.b__0() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +253 System.Web.Mvc.<>c__DisplayClass24_1.<InvokeActionMethodWithFilters>b__2() +22 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +253
System.Web.Mvc.<>c__DisplayClass24_1.b__2() +22
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +189
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +521
System.Web.Mvc.Controller.ExecuteCore() +95
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +180
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller) +40
EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +24
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +103
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159

New configuration: hide delete translation button

Hi,

Related to Issue #41
In Episerver AdminUI if one uses the delete button to remove the text, it deletes the record for the translation and it will not get exported, therefore will not get imported.
Hiding the button solves the problem, the user has to delete the text and save if as empty.

Thanks in advance!

Zsolt

Episerver Admin UI JSON import does not invalidate cache in Load Balanced environment

Hi!

This is very similar to issue #33

If a JSON file is imported in Admin UI, occasionally the Episerver Cache is not invalidated and frontoffice servers in a load balanced environment does not have the updated resource.

The issue seems to be always specific to selected resource key. The first few imports update the cache on other servers for the selected resource key, but after that for the particular resource key it is broken (for that lifetime of application pool on the frontoffice server), although in the same import process I update multiple resources and an other one gets refreshed on the frontoffice servers.
I checked in HttpContext.Cache the LocalizationResource object is the old one until a restart for a resource key which is not getting updated on the front office server, so for some reason the cache on Frontoffice is not getting updated.
I am not doing anything fancy, just appended a number at the end of a translation and counting it up. The resource is bound with code.
Changes in CMS getting synced and if I try changing another resource key it works.

Cache will be always correctly invalidated if I change a value in Admin UI manually, I could not reproduce the problem there.
Sorry I cannot give you more specific details, I tried to looked at the code but I could not find anything - if you need me to run some tests, let me know.

Good news is - our testers have finished testing the import for the current version :-)

Using version 5.7.3

Thanks in advance!

JsResourceHandler doesn't use fallbacklanguage

Hi,

In our episerverframework config we have a setup like this:

<localization fallbackBehavior="Echo, MissingMessage, FallbackCulture" fallbackCulture="en-GB">
    <providers>
      <add name="db" type="DbLocalizationProvider.EPiServer.DatabaseLocalizationProvider, DbLocalizationProvider.EPiServer" />
    </providers>
  </localization>

and in out initilizer I have added this code (just to test if it works, but it doesn't change the outpout

ConfigurationContext.Setup(ctx =>
{
    ctx.DefaultResourceCulture = new CultureInfo("en-GB");
});

And the epi language settings, these is the settings:
bilde

In epi localization mode I can see these translations
bilde

When I look at the translation for the key "Norrona.Commerce.Framework.Translations.Profile.BetaTesterLabel" in english in the jsl10n, then I see it fine (because it is filled out)
But when I go to the norwegian jsl10n, then it is not in the resource at all

Live example urls here:
English: https://www.norrona.com/jsl10n/Norrona.Commerce.Framework.Translations.Profile?lang=en-GB
Norwegian: https://www.norrona.com/jsl10n/Norrona.Commerce.Framework.Translations.Profile?lang=nb-NO

This is for the latests packages (5.7.1)

if I add this code instead

ConfigurationContext.Setup(ctx =>
{
    ctx.DefaultResourceCulture = CultureInfo.InvariantCulture;
    ctx.EnableInvariantCultureFallback = true;
});

 UiConfigurationContext.Setup(ctx => { ctx.ShowInvariantCulture = true; });

Then it kinda works, I get the translation in english, but the InvariantCulture is not possible to edit, if it was possible to edit then that would have been a solution for us

DbLocalizationProvider.MigrationTool does not create SQL for empty resources

Hi,

I used the following command to create an SQL script from our XML resources:

packages\DbLocalizationProvider.MigrationTool.5.6.0\tools\DbLocalizationProvider.MigrationTool.exe -s MyWebApplication -e --resourceDirectory Lang -x

And a few weeks later I noticed that for resources, where in all languages there was no value defined, the tool did not create any entry. So we XML looks like this:

There is no entry created.
For resources where at least one language has a non-empty value, were exported.

For me it is not an issue anymore. I already migrated and only 3 resources were missing, I added them manually.
Thanks.

CVE-2018-14041 (Medium) detected in bootstrap-3.0.0.min.js

CVE-2018-14041 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.0.0.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/js/bootstrap.min.js

Path to vulnerable library: /localization-provider-epi/src/DbLocalizationProvider.AdminUI.EPiServer/modules/_protected/DbLocalizationProvider.AdminUI.EPiServer/ClientResources/bootstrap.min.js,/localization-provider-epi/src/DbLocalizationProvider.AdminUI.EPiServer/DbLocalizationProvider.AdminUI.EPiServer/ClientResources\bootstrap.min.js

Dependency Hierarchy:

  • bootstrap-3.0.0.min.js (Vulnerable Library)

Found in HEAD commit: d8354fd8bce4d052c67f5a0aa51b5a113b99b712

Vulnerability Details

In Bootstrap before 4.1.2, XSS is possible in the data-target property of scrollspy.

Publish Date: 2018-07-13

URL: CVE-2018-14041

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-14041

Release Date: 2019-06-12

Fix Resolution: 4.1.2


Step up your Open Source Security Game with WhiteSource here

Javascript Resource Handler gives object reference not set

Good day,

I'm trying to use the DbLocalizationProvider.EPiServer.JsResourceHandler, and have added
@Html.GetTranslations(typeof(Translations))
to my layoutfile, unfortanly it doesn't work for my project and I just get a "Object reference not set to an instance of an object"
bilde

I guess it have something to do with that that file have lots (then I mean lots) of nesting, and something goes wrong futher down, but I'm not sure how to debug this. Any tips?

Here is my translation file
https://gist.github.com/Sebbe/fb8171cbc10a4ece7090c460011ff052

Possible Performance Issue

Hi,

Have a look at https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2019/4/episerver-cms-mode-page-tree-performance/
Today I managed to run a profiler on azure SQL DB and could see
there are thousands and thousands of calls to below SP on loading just editor area

Calls to this SP started at 12:39 and continued fro different items until 12: 45, DB was busy in processing just those request.

From Chrome, I could see 502 errors for following JS after 4 mins
EpiServer.shared.js
EPiserver.shell.ui.resources.js

EPiServer editor will not load in result until we recycle app pool.
The front side will also be effected after the first call to the CMS Editor.

Do you think DBLoaclization is causing this or the way EPiServer.CMS 11.11.2 is using Localization in Editor area.

I upgraded EPiServer.CMS 11.8.0 to 11.11.2
and DbLocalizationProvider.EPiServer from 4.3.3 to 5.5.0

exec sp_executesql N'SELECT
[Project2].[Id] AS [Id],
[Project2].[ResourceKey] AS [ResourceKey],
[Project2].[ModificationDate] AS [ModificationDate],
[Project2].[Author] AS [Author],
[Project2].[FromCode] AS [FromCode],
[Project2].[IsModified] AS [IsModified],
[Project2].[IsHidden] AS [IsHidden],
[Project2].[C1] AS [C1],
[Project2].[Id1] AS [Id1],
[Project2].[ResourceId] AS [ResourceId],
[Project2].[Language] AS [Language],
[Project2].[Value] AS [Value],
[Project2].[LocalizationResource_Id] AS [LocalizationResource_Id]
FROM ( SELECT
[Limit1].[Id] AS [Id],
[Limit1].[ResourceKey] AS [ResourceKey],
[Limit1].[ModificationDate] AS [ModificationDate],
[Limit1].[Author] AS [Author],
[Limit1].[FromCode] AS [FromCode],
[Limit1].[IsModified] AS [IsModified],
[Limit1].[IsHidden] AS [IsHidden],
[Extent2].[Id] AS [Id1],
[Extent2].[ResourceId] AS [ResourceId],
[Extent2].[Language] AS [Language],
[Extent2].[Value] AS [Value],
[Extent2].[LocalizationResource_Id] AS [LocalizationResource_Id],
CASE WHEN ([Extent2].[Id] IS NULL) THEN CAST(NULL AS int) ELSE 1 END AS [C1]
FROM (SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[ResourceKey] AS [ResourceKey],
[Extent1].[ModificationDate] AS [ModificationDate],
[Extent1].[Author] AS [Author],
[Extent1].[FromCode] AS [FromCode],
[Extent1].[IsModified] AS [IsModified],
[Extent1].[IsHidden] AS [IsHidden]
FROM [dbo].[LocalizationResources] AS [Extent1]
WHERE [Extent1].[ResourceKey] = @p__linq__0 ) AS [Limit1]
LEFT OUTER JOIN [dbo].[LocalizationResourceTranslations] AS [Extent2] ON [Limit1].[Id] = [Extent2].[ResourceId]
) AS [Project2]
ORDER BY [Project2].[Id] ASC, [Project2].[C1] ASC',N'@p__linq__0 varchar(8000)',@p__linq__0='/contenttypes/MYBLOCKSNAME/description'

Anonymous / everyone needs change permissions on language.

Hello,

in the query handler EPiServerAvailableLanguages you check if the current identity has edit access for a specific language. (QueryEditAccessRights()).

In a default setup this works, as 'everyone' has by default change (edit) rights. But we tweak these permissions, to avoid that content editor of country x can change translations of country y.

Is there a reason that you enforce edit rights to enable a language?

For the moment I configured a custom handler without the check (where clause).

kind regards,

bob

Version 5.4.0 makes edit mode slow

I had version 5.4.0 installed in a episerver 11.11.2 solution and it it took about 5 minutes just to enter edit mode. Downgraded to version 5.0.0 and now it's fast again.

I only experienced this error locally on my developer machine. In test and production everything was good. I had the site running in IIS Express and I am working through a VPN to my office so the database connection is a little bit slow, but not that slow.

In the event viewer log a got a lot of this error. "The WebSocket instance cannot be used for communication because it has been transitioned into an invalid state."

I have these nugets installed:
LocalizationProvider
LocalizationProvider.Abstractions
LocalizationProvider.AspNet
LocalizationProvider.EPiServer
LocalizationProvider.AdminUI.EPiServer

"Page could not be loaded" when opening Localization tab in EPiServer

Hello,
We use the DbLocalizationProvider for translations of our EpiServer site. This site is in development and not yet live. We have several environments such as test and acceptance. The other day someone used the Localization tab in EpiService to do an export in the test environment, and imported the result in the acceptance environment. Since then, if you open the Localization tab in EPiService, the page only shows "Page could not be loaded. The link you specified does not work. This may either be the result of temporary maintenance or an incorrect link."
I've been investigating this issue for two days now but haven't found a solution yet.
In the acc environment the logging shows a ArgumentNullException in LocalizationResourcesController. It seems that this exception occurs when method LocalizationResourcesController.GetAllResources() tries to create a CultureInfo object will a culture name that is null.
We copied the database from the acceptance environment and I use that copy to reproduce the issue locally. I get the same issue, but for some reason I don't get the exception in the logging.
Things we have tried:

  • Clear the LocalizationResources and LocalizationResourceTranslations tables before starting the site. They are filled automatically but the problem persists.
  • Build the DbLocalization sources and use these instead of the NuGet packages in the hope to debug the DbLocalization library. Breakpoints in AdminUISetupModule are hit, but no breakpoint is hit in LocalizationResourcesController. Enabling Common Language Runtime Exceptions didn't help.
  • Play with ConfigurationContext settings, such as enabling diagnostics, setting the default resource culture and disabling DiscoverAndRegisterResources.

We have 2 languages enabled in EPiServer, "nl-NL" and "en-US". The default language is "nl-NL". After startup the LocalizationResources table has 92 rows and the LocalizationResourceTranslations table has 184 rows, twice the amount as expected. However one half of the translations has Language set to "nl-NL" and the other half has Language set to empty. I'm not sure if that is normal.

Could you please help?
Kind regards,
Sander Rorije

CVE-2018-14040 (Medium) detected in bootstrap-3.0.0.min.js

CVE-2018-14040 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.0.0.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/js/bootstrap.min.js

Path to vulnerable library: /tests/DbLocalizationProvider.EPiServer.Sample/modules/_protected/DbLocalizationProvider.AdminUI.EPiServer/ClientResources/bootstrap.min.js

Dependency Hierarchy:

  • bootstrap-3.0.0.min.js (Vulnerable Library)

Found in HEAD commit: d8354fd8bce4d052c67f5a0aa51b5a113b99b712

Found in base branch: main

Vulnerability Details

In Bootstrap before 4.1.2, XSS is possible in the collapse data-parent attribute.

Publish Date: 2018-07-13

URL: CVE-2018-14040

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: twbs/bootstrap#26630

Release Date: 2018-07-13

Fix Resolution: org.webjars.npm:bootstrap:4.1.2,org.webjars:bootstrap:3.4.0


Step up your Open Source Security Game with WhiteSource here

Episerver AdminUI JSON import does not work if language not active

We have the setup that in development environment we have only 2 languages activated in Episerver CMS, but in production 14. We need to synchronise the resources in both ways. If we export JSON on production and try to import in development, we get the following message and the import is not possible:
'Importing language cs, da, fr, hr, hu, it, nl, pl, ro, sk, sl, tr is not available in current EPiServer installation.'

It seems to be an extra check, I do not really understand the reason for this, but it makes the import impossible with JSON. We do not want to activate the same set of languages in the target environment? All the resources in all languages were imported in development environment with the migration tool, so they are there and there should be no reason not to be able to import then.

Using DbLocalizationProvider.AdminUI.EPiServer version 5.6.0.

[EPiServer] "Object reference not set to an instance of an object." When importing an export

When we try to import an export from any of our OTAP environments to each other, the import tool just states; Import failed! Reason: Object reference not set to an instance of an object.

As I dug to the export file it's failing because of this item. Here it's observed that translations start with null

[   
  {
    "id": 634,
    "resourceKey": "countries.CH",
    "modificationDate": "2019-09-07T21:36:50.667Z",
    "author": "[email protected]",
    "isModified": true,
    "translations": [
      null,
      {
        "id": 2906,
        "resourceId": 634,
        "language": "nl-NL",
        "value": "Zwitserland"
      },
      {
        "id": 2907,
        "resourceId": 634,
        "language": "en",
        "value": "Switzerland"
      },
      {
        "id": 2909,
        "resourceId": 634,
        "language": "de-CH",
        "value": "Schweiz"
      },
      {
        "id": 2908,
        "resourceId": 634,
        "language": "fr-CH",
        "value": "Suisse"
      }
    ]
  }
]

EnableInvariantCultureFallback ignored?

Hi Valdis,

I was wondering if you could provide some insight into what I'm trying to achieve with the localization provider.
I have a requirement where I need to query the provider for localized labels in the fallback languages configured for the current page in EPiServer.
So for instance, if the fallbacks are defined as en-US => en-GB => en-CA
I want to first see if there is a label for en-US and if not test if one exists for en-GB.
However when I call GetString(expression, en-US) I always get a label back even though there isn't one configured - it looks like it is falling back to the invariant culture of EN, in which there is a label.

I have tried setting EnableInvariantCultureFallback to false on initialize but it still appears to fallback.

ConfigurationContext.Setup(ctx => { ctx.EnableInvariantCultureFallback = false; });

Do you have any ideas? Looking at the decompiled provider code it looks like it should return null but its not.

Thanks again
Paul

JSON import of empty resource gets ignored

Hi,

Me again - our testers started testing :-)

If in source system in Admin UI for one resource you delete the value, then do a JSON export, and on target system do an import, the change is not picked up at all.
We have a few resources where the customer in the past decided not to display anything, so this can happen to us.

Another (similar, but a bit unlikely) case that in source system in Admin UI do the following changes for one resource:
-in English make same changes (Text1 -> Text2)
-in German delete the value (Text1 -> "")
Export, then import on target system. Only the change in German gets imported, empty text gets ignored again.

Using version 5.7.3.

Thanks!

The argument 'nameOrConnectionString' cannot be null, empty or contain only white space.

Hi,

After an upgrade of
EPi cms 11.11.2
LocalizationProvider 5.3.0

on few environments, in Azure we are having the following issue on-site startup. Any Help?

[ArgumentException: The argument 'nameOrConnectionString' cannot be null, empty or contain only white space.]
System.Data.Entity.Utilities.Check.NotEmpty(String value, String parameterName) +79
System.Data.Entity.DbContext..ctor(String nameOrConnectionString) +34
DbLocalizationProvider.LanguageEntities..ctor(String connectionString) +17
DbLocalizationProvider.AspNet.Queries.GetResourceHandler.Execute(Query query) +105
DbLocalizationProvider.AspNet.Queries.GetTranslationHandler.Execute(Query query) +538
DbLocalizationProvider.EPiServer.DatabaseLocalizationProvider.GetString(String originalKey, String[] normalizedKey, CultureInfo culture) +90
EPiServer.Framework.Localization.ProviderBasedLocalizationService.LoadString(String[] normalizedKey, String originalKey, CultureInfo culture) +122
EPiServer.Framework.Localization.LocalizationService.TryGetStringByCulture(String originalKey, String[] normalizedKey, CultureInfo culture, CultureInfo fallbackCulture, String& localizedString) +140
EPiServer.Framework.Localization.LocalizationService.GetStringByCulture(String resourceKey, FallbackBehaviors fallbackBehavior, String fallback, CultureInfo culture) +321
EPiServer.Framework.Localization.LocalizationService.GetStringByCulture(String resourceKey, FallbackBehaviors fallbackBehavior, CultureInfo culture) +22
EPiServer.Framework.Localization.LocalizationService.GetString(String resourceKey) +70
EPiServer.Forms.EditView.InitializationModule.SetupFormContainerProperties() +708
EPiServer.Forms.EditView.InitializationModule.Initialize(InitializationEngine context) +192
EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +58
EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context) +123
EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +248

Old navigation is displayed and navigation doesn't work when in Localization Admin mode

<package id="DbLocalizationProvider.AdminUI.EPiServer" version="5.7.0" targetFramework="net461" />
<package id="DbLocalizationProvider.EPiServer" version="5.7.0" targetFramework="net461" />
<package id="EPiServer.CMS.Core" version="11.12.0" targetFramework="net461" />
<package id="EPiServer.CMS.UI.Core" version="11.21.0" targetFramework="net461" />

New UI:
image

When in Localization admin page, localization navigation item is missing and can't click on the other menu items to go back to CMS, Commerce etc. There is no exception in the browser console. Basically, nothing happens when clicking.

image

Export includes deactivated language. Fails to import.

I'm working on a solution where we have several languages installed. One of these languages have at one point been deactivated.

If we now do an export the deactivated language is included in the export, but when we try to do an import we get an error saying "Importing language 'se' is not available in current EPiServer installation".

We are currently running version 5.4.0

Episerver Admin UI JSON import does not invalidate cache in Load Balanced environment

Hi,

If a JSON file is imported in Admin UI, the Episerver Cache is not invalidated and other servers in a load balanced environment does not have the latest resources. Workaround is to restart all other servers.
I have not validated if XLIFF import have the same issue.
Cache will be invalidated if I change a value im Admin UI manually.

Using version 5.6.0 (sorry I did not have the time to test with 5.7.0).

Thanks in advance!

Episerver AdminUI XLIFF Export does not work the second time

If I try to export again with either a different or the same language selection, I get the exception below. Apparently the frontend appends sourceLang and targetLang query string parameters twice.
Workaround is to reload the page after each export.

Package: DbLocalizationProvider.AdminUI.EPiServer.Xliff.5.4.0

First try, working URL:
http://localhost:61977/EPiServer/DbLocalizationProvider.AdminUI.EPiServer/LocalizationResources/ExportResources?format=xliff&sourceLang=de&targetLang=fr

Second try, incorrect URL:
http://localhost:61977/EPiServer/DbLocalizationProvider.AdminUI.EPiServer/LocalizationResources/ExportResources?format=xliff&sourceLang=de&targetLang=fr&sourceLang=de&targetLang=en

Exception:

Server Error in '/' Application.
Culture is not supported.
Parameter name: name
de,de is an invalid culture identifier.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Globalization.CultureNotFoundException: Culture is not supported.
Parameter name: name
de,de is an invalid culture identifier.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[CultureNotFoundException: Culture is not supported.
Parameter name: name
de,de is an invalid culture identifier.]
   System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride) +192
   DbLocalizationProvider.Xliff.Exporter.Export(ICollection`1 resources, NameValueCollection parameters) +129
   DbLocalizationProvider.AdminUI.LocalizationResourcesController.ExportResources(String format) +103
   lambda_method(Closure , ControllerBase , Object[] ) +104
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.<>c__DisplayClass24_0.<InvokeActionMethodWithFilters>b__0() +55
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
   System.Web.Mvc.<>c__DisplayClass24_1.<InvokeActionMethodWithFilters>b__2() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
   System.Web.Mvc.<>c__DisplayClass24_1.<InvokeActionMethodWithFilters>b__2() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +189
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +521
   System.Web.Mvc.Controller.ExecuteCore() +95
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +180
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller) +40
   EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +24
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +103
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159

Episerver AdminUI JSON import: Import failed! Reason: Object reference not set to an instance of an object.

Hi,

When I tried to test the resolved issue #30 (#30 (comment)), I noticed that my JSON import does not work generally. Happens also in version 5.6.0 and in 5.7.0, does not matter if the same set of languages are activated on source and target systems.
The error I get right after upload is: "Import failed! Reason: Object reference not set to an instance of an object."
I could not find the possible NullReferenceException in EPiServerErrors.log, maybe I am missing some logging configuration for DbLocalizationProvider.
Sorry I cannot provide the import file here on github.

Thanks in advance!

fromcode always zero after restart

Hello,

in the example alloy project from issue #9 I added some resources

synchronisation of newly found resources at startup works ok. (fromcode = 1)

but now all resources suddenly have fromcode field = 0 after a restart ?
and don't get updated anymore when text in source code changes ?

If I do this:
update [LocalizationResources] set FromCode = 1
then restart
all rows have FromCode = 0 again

SELECT [Id]
      ,[ResourceKey]
      ,[ModificationDate]
      ,[Author]
      ,[FromCode]
      ,[IsModified]
      ,[IsHidden]
  FROM [EPiServerDB_1848eeb6].[dbo].[LocalizationResources]
Id	ResourceKey	ModificationDate	Author	FromCode	IsModified	IsHidden
37	Alloy.Resources.FaqResources.WhatAreYouLookingFor	2019-03-08 10:33:59.290	type-scanner	0	0	0
38	Alloy.Resources.FaqResources.NoMatchingResults	2019-03-08 10:33:59.293	type-scanner	0	0	0
39	Alloy.Resources.FaqResources.MoreInformation	2019-03-08 10:33:59.293	type-scanner	0	0	0
40	Alloy.Resources.FaqResources.ViewAllQuestions	2019-03-08 10:33:59.293	type-scanner	0	0	0
41	Alloy.Resources.FaqResources.BackToTop	2019-03-08 10:33:59.297	type-scanner	0	0	0

Can't create new resource using AdminUI

I'm unable to create new resources using the AdminUI anymore.. I can activate the new resource elements by removing the "hidden" class manually from the dom element.

Mock the DbLocalizationProvider functionality in a UnitTest

Hi Valdis,

We are using the DbLocaliztionProvider in our project and I'm trying to unit test some logic that also uses the DbLocaliztionProvider logic, but I'm having trouble with mocking the response of the extension method from the namespace DbLocalizationProvider.

public static class LocalizationServiceExtensions
{
public static string GetString(
this LocalizationService service,
Expression<Func> resource,
params object[] formatArguments)
{
return service.GetStringByCulture(resource, CultureInfo.CurrentUICulture, formatArguments);
}
...
}

_localizationService.GetString(() => Resources.CreateOrder.Success);

Do you have any tips on how to approach this?
Or maybe an example?

DbLocalizationProvider.EPiServer 5.1.2 crash

DbLocalizationProvider.EPiServer 5.1.1 is fine

(latest episerver nuget versions and latest nuget version of all the other localization nuget packages)

DbLocalizationProvider.EPiServer 5.1.2 crashes :

[TypeLoadException: Could not load type 'EPiServer.Data.Internal.DataAccessOptions' from assembly 'EPiServer.Data, Version=11.11.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'.]
DbLocalizationProvider.EPiServer.DbLocalizationProviderConnectionFixModule.Initialize(InitializationEngine context) +0
EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +58
EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context) +123
EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +248

[InitializationException: Initialize action failed for Initialize on class DbLocalizationProvider.EPiServer.DbLocalizationProviderConnectionFixModule, DbLocalizationProvider.EPiServer, Version=5.1.2.0, Culture=neutral, PublicKeyToken=e24b5062d4cb23b0]
EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +774
EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +194
EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +876
EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +225
EPiServer.Global..ctor() +42
EpiWebsite.Global..ctor() +37
ASP.global_asax..ctor() +42

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +139
System.Activator.CreateInstance(Type type, Boolean nonPublic) +105
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1431
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +184
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +27
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +182
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714

Typescanner creates resources multiple times in load balanced environment

Hi,

I could not test this issue myself, but in an environment where there were no resources yet created and DbLocalizationProvider tried to create all 2051 resources defined in code, created 141 resources two times and 6 resources even three times. We have 6 servers, all were started paralelly.
I was hoping maybe you have an idea on this, is the registration load-balance safe? (Apparently there is no unique constraint on ResourceKey)
Using version 5.6.0 with Episerver.

Thanks!

Help text translation disappeared

Epi ver. 11.10.5.0
DbLocalizationProvider.EpiServer 5.0.0.0

After upgrading from 4.3.5.0 to the latest version, I noticed on some pages that help text is not translated/applied in the admin UI for the properties. Other translations work.

Translation screen:
article_page_translation

Code:

[ResourceKey("name", Value = "Article Page")]
    [ResourceKey("description", Value = "The article page used as a news article or as a general content page.")]
    [LocalizedResource(KeyPrefix = "/contenttypes/articlepage/", Inherited = false)]
    public class ArticlePageLocalization: IArticlePage
    {
        [ResourceKey("properties/heroimage/caption", Value = "Hero Image")]
        [ResourceKey("properties/heroimage/help", Value = "Set optional hero image.")]
        public Url HeroImage { get; set; }

        [ResourceKey("properties/title/caption", Value = "Title")]
        [ResourceKey("properties/title/help", Value = "Set article page title, if nothing is set page name will be used")]
        public string Title { get; set; }
        ... (omitted a rest of code)

I'm aware that Epi caches things a lot, I tried to restart app pool/website, but it didn't help.

What could be the problem?

Thanks

Model with data annotation attributes cannot have more than one `[ResourceKey]` attribute

Hi,
I am not sure what I am doing wrong, but I keep getting the following exception:
"Model with data annotation attributes cannot have more than one [ResourceKey] attribute".

Stacktrace:
[InvalidOperationException: Model with data annotation attributes cannot have more than one [ResourceKey] attribute.] DbLocalizationProvider.Sync.Collectors.<GetDiscoveredResources>d__0.MoveNext() +790 System.Collections.Generic.List1..ctor(IEnumerable1 collection) +186 System.Linq.Enumerable.ToList(IEnumerable1 source) +54
DbLocalizationProvider.Sync.LocalizedTypeScannerBase.DiscoverResourcesFromMember(Type target, Object instance, MemberInfo mi, String resourceKeyPrefix, Boolean typeKeyPrefixSpecified, Boolean isHidden, String typeOldName, String typeOldNamespace) +328
DbLocalizationProvider.Sync.<>c__DisplayClass2_0.b__0(MemberInfo mi) +43
System.Linq.d__172.MoveNext() +170 System.Collections.Generic.List1..ctor(IEnumerable1 collection) +246 System.Linq.Enumerable.ToList(IEnumerable1 source) +54
DbLocalizationProvider.Sync.LocalizedTypeScannerBase.DiscoverResourcesFromTypeMembers(Type target, ICollection1 members, String resourceKeyPrefix, Boolean typeKeyPrefixSpecified, Boolean isHidden, String typeOldName, String typeOldNamespace) +201 DbLocalizationProvider.Sync.LocalizedResourceTypeScanner.GetResources(Type target, String resourceKeyPrefix) +172 DbLocalizationProvider.Sync.TypeDiscoveryHelper.ScanResources(Type target, String keyPrefix, IResourceTypeScanner scanner) +239 DbLocalizationProvider.Sync.<>c__DisplayClass4_0.<RegisterDiscoveredResources>b__0(Type type) +14 System.Linq.<SelectManyIterator>d__172.MoveNext() +170`

I have read all the other questions which are mentioning the same issue. I am using LocalizedResource and not LocalizedModel. When the AllowedTypes is commented out, everything works fine.

[SiteContentType(GUID = "19671657-B684-4D95-A61F-8DD4FE60D554")]
	[ResourceKey("name", Value = "Start page")]
	[ResourceKey("description", Value = "The start page.")]
	[LocalizedResource(KeyPrefix = "/contenttypes/startpage/", Inherited = false)]	
	public class StartPage : SitePageData
	{
		[Display(
			GroupName = SystemTabNames.Content,
			Order = 320)]
		[CultureSpecific]
		[ResourceKey("properties/maincontentarea/caption", Value = "Main content area")]
		[ResourceKey("properties/maincontentarea/help", Value = "Add content to the main content area.")]
		public virtual ContentArea MainContentArea { get; set; }

		[Display(
			GroupName = SystemTabNames.Content,
			Order = 100)]
		[CultureSpecific]
		[ResourceKey("properties/mainbody/caption", Value = "Main content body")]
		[ResourceKey("properties/mainbody/help", Value = "Add content to the main content body.")]
		public virtual XhtmlString MainBody { get; set; }

		[Display(
			GroupName = SiteTabNames.SiteSettings,
			Order = 10)]
		[ResourceKey("properties/pagenotfound/caption", Value = "Not found page")]
		[ResourceKey("properties/pagenotfound/help", Value = "Link to the page which is shown when a page could not be found.")]
		[AllowedTypes(new[] { typeof(ErrorPage.ErrorPage) })]
		public virtual ContentReference PageNotFound { get; set; }

		[Display(
			GroupName = SiteTabNames.SiteSettings,
			Order = 20)]
		[ResourceKey("properties/servererrorpage/caption", Value = "Server error page")]
		[ResourceKey("properties/servererrorpage/help", Value = "Link to the page which is shown when a server error occurs.")]
		[AllowedTypes(new[] { typeof(ErrorPage.ErrorPage) })]
		public virtual ContentReference ServerErrorPage { get; set; }
	}

I am using the following versions:

<package id="LocalizationProvider" version="5.7.0" targetFramework="net472" />
<package id="LocalizationProvider.Abstractions" version="5.7.0" targetFramework="net472" />
<package id="LocalizationProvider.AspNet" version="5.7.0" targetFramework="net472" />
<package id="LocalizationProvider.JsResourceHandler" version="5.7.0" targetFramework="net472" />
<package id="DbLocalizationProvider.AdminUI.EPiServer" version="5.7.0" targetFramework="net472" />
<package id="DbLocalizationProvider.EPiServer" version="5.7.0" targetFramework="net472" />
<package id="DbLocalizationProvider.EPiServer.JsResourceHandler" version="5.7.0" targetFramework="net472" />

Hope you can help me out.

Buttons and labels are not shown in its user friendly alias

We've installed dblocalization provider for episerver in our network. Everything works fine so far except that all labels and button texts are originating from their identifier and not from the user friendly alias. This happens in integration as well as in production environment. See screenshot below. Translations in the hidden ressource keys for german and english exists.
Is there any file or configuration that is missing?

thanks,
Markus

image

Add support for easy enum localization in EpiServer properties

Episerver allows to define Enum properties and customize their appearance in editor using selection factories. To have support for that, one would have to create own selection factory and call localization service to get text values. It it certainly possible, but somewhat cumbersome.

Would be great if this library contained:

  • LocalizedEnumSelectionFactory<T> - selection factory that provides values with localized enum names
  • LocalizedEnumAttribute - attribute that hooks up EpiServer property to LocalizedEnumSelectionFactory

Then Enum localization could be achieved by adding:

  • LocalizedEnum attribute to the EpiServer property
  • LocalizedResource attribute to the Enum itself
  • Display attributes to Enum values

Creating and deleting resources

Hi,

I have just installed this plugin and it seems pretty smooth! However i have a question regarding the possibility of creating and deleting resources from the admin ui.

I can see the create new resource button from the admin ui, however nothing seems to happend when i click on it. And i am logged in as a user with Administrator right, im not sure if i am missing something here with the configuration.
image

I am also wondering about deleting resources that is missing from code, is this possible somehow?

Thanks in advance! :)

/Daniel

Episerver AdminUI XLIFF Export does not export all resources

If in AdminUI I export in XLIFF 2.0 Format, it exports only AdminUI resources, it does not export other resources (in my case legacy resources import with MigrationTool). It seems to be regardless of which language or which display view is selected in AdminUI.

With package LocalizationProvider.Xliff.5.4.1
JSON export works fine.

language fallback problem with versions higher than 5.3.0 (episerver)

Hello,
I use this library with episerver
If I use nuget packages > 5.3.0
Then I see in the admin UI only the 4 main languages that have resources:
image
so e.g. fallback from nl-BE to nl won't work anymore.

With 5.3.0 I see in the admin UI all languages that exist in Episerver:
image
now e.g. fallback from en-GB to en works fine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.