U4-541 - Wrong dictionary key when using in backend template names

Created by Sebastiaan Janssen 19 Aug 2012, 14:53:54 Updated by Sebastiaan Janssen 06 Oct 2013, 16:57:01

When you use dictionary keys for names on templates, documents types etc in the backend it somehow picks the wrong language key.

In my example, I have English and Swedish installed. And I am logged in as admin with English culture. But it still picks the swedish key for the name of the template which in this case has not been translated. It looks like it ignores the choosen culture of the user on these places.

''Originally created on CodePlex by [kalletoxic|http://www.codeplex.com/site/users/view/kalletoxic]'' on 2/24/2012 9:35:20 AM [Codeplex ID: 30742 - Codeplex Votes: 9]

Imported comments

''Comment by [ToxicPeter|http://www.codeplex.com/site/users/view/ToxicPeter] on 2/24/2012 10:31:48 AM:'' I'm not sure here, but I think dictionary items only work properly in the frontend - based on the host configuration of nodes. In the backend, you're sort of "not in there". But it is extremely counter-intuitive that it doesn't work in the backend according to the user locale - and it should be a five-minute job to fix (if I've analyzed the problem correctly).

''Comment by [bigfinger|http://www.codeplex.com/site/users/view/bigfinger] on 2/24/2012 9:35:36 PM:'' Have you tried setting the default culture and ui culture to sv-SE in your web.config?

''Comment by [kalletoxic|http://www.codeplex.com/site/users/view/kalletoxic] on 2/26/2012 1:52:48 PM:'' @bigfinger The problem is that I get swedish when i should get english! Its works correctly on propertys inside document types for instance.

1 Attachments

Comments

Maarten van der Donk 30 Jul 2013, 10:51:52

I've added a screenshot to show this problem still exists in Umbraco v6.1.3 and to show the problem isn't only limited to template names. It seems user account culture is set too late, because of this the default system culture is used (which in my case is nl-NL). In the screenshot the user account culture is set to en-US but it is still showing the nl-NL translation in the Templates tree on the left (highlighted in red), this also happens on the structure checkboxlist. The template is correctly translated on the right (highlighted in green) at 'Allowed templates' and 'Default template'. The document types tree isn't translating at all, it is just showing the names (which in this example is '#Home'), highlighted in red. This problem also applies to the 'Description' value on the right (also highlighted in red).

If I change my user's culture to en-US only the green marked area's on the screenshot are working properly. All the red highlighted area's remain the same.

Here is the screenshot: !en-US_documenttype.png!

@bigfinger, I've tried setting my default culture to en-US in the web.config. This removes the problem of showing nl-NL translation (which happens at the templates tree), but when I change my user's culture to nl-NL it will still be showing the en-US translation instead of the nl-NL translation.


Shannon Deminick 02 Aug 2013, 05:17:18

Holy crap! I had no idea that you could even do this in the back office :)

I've fixed this up in revision: c4b44ea0e391a53381d1e47e67625245e316c2f7

We set the user's culture in the http module during the Authentication phase for any back office requests.


Maarten van der Donk 02 Aug 2013, 07:12:54

Hi Shannon, I've tested your changes and all seems well except the node name in the Document Types tree. It still shows #Home (as shown in the above screenshot) instead of the dictionary item value. Structure and Templates tree seem to be working correctly.

In my previous comment I mentioned Description and Name (both properties of a Document Type) aren't working correctly but this isn't the case. Obviously these values shouldn't be translated with the dictionary item values, so this is working correctly.


Shannon Deminick 02 Aug 2013, 07:16:51

Ah right, That'll be purely because the logic isn't implemented in the doc type/media type tree to change the name based on a dictionary value. This is kind of why I didn't even know this was possible since I've not seen the logic before in the core.


Sebastiaan Janssen 22 Aug 2013, 08:30:50

Didn't realize this was still open. Some of it is fixed for 6.1.4, the rest will need to wait for the next release. Sorry for missing this one!


Lars-Erik Aabech 26 Sep 2013, 08:43:45

Make sure to test export/import of templates via package or usync too. The dictionary value is exported as name in the template definition instead of the dictionary key. (And dunno what would happen if manually fixed and imported)


Sebastiaan Janssen 06 Oct 2013, 16:56:58

Fixed in rev 34b7f86b8ba83663a8d8e7e610dbada263062fbb and b2980cedc6e00a63a1eb84ae80dada2592c99f79 (applied to mediaTypes tree as well). @Lars-Erik Yes, my change works with import/export as well as it only changes the way the tree item is rendered, the packager still uses the actual name (for ex. "#dictionary").


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category: Localization

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.0.4, 6.1.1, 6.1.3

Due in version: 6.2.0

Sprint:

Story Points:

Cycle: