Localization of core ContentTypes for Title only?

Topics: Localization
Sep 28, 2014 at 7:56 PM
Localizing Content seems to work as is and I find it to be a acceptable feature. But the problem starts when you have to localize every Core ContentType with a TitlePart just for rendering that.

I'll give an example, I have a News Content Type, I have a projection widget with a query that queries only current culture so I see only the correct language. So in theory I should only have to create one projection widget and it returns the correct stuff. But If I want to render the Title of the Projection I would need two. I also need two of every Menu Items, etc.

Is there a simpler way out there. Does a translation file handle TitleParts of your created Contents?
Developer
Sep 28, 2014 at 9:43 PM
I'm afraid not - you'll have to have two Projection content items, where on is the default language, and the other its translation. Unless you create a PO file that contains the translation - but that will break as soon as the user changes the projection title.

What I think we might need is some sort of table of translations, manageable from the dashboard, and a token called something like {T:MyKey}. That token look into the table for the current culture, and return the translation associated with the specified key. The title of your projection would then simply be: {T:MyProjectionTitle}. This would also solve the problem of Content Type display names, content part descriptions, and other areas where we currently don't have a way to provide a translation other than using PO files (which is less than ideal since the user can change content type names and content part descriptions at any time).

Anyway, that doesn't help you now, so I'm afraid you'll have to create a translation for your Projection (unless you hardcode that title in the view using T).
Sep 28, 2014 at 11:21 PM
sfmskywalker wrote:
I'm afraid not - you'll have to have two Projection content items, where on is the default language, and the other its translation. Unless you create a PO file that contains the translation - but that will break as soon as the user changes the projection title.

What I think we might need is some sort of table of translations, manageable from the dashboard, and a token called something like {T:MyKey}. That token look into the table for the current culture, and return the translation associated with the specified key. The title of your projection would then simply be: {T:MyProjectionTitle}. This would also solve the problem of Content Type display names, content part descriptions, and other areas where we currently don't have a way to provide a translation other than using PO files (which is less than ideal since the user can change content type names and content part descriptions at any time).

Anyway, that doesn't help you now, so I'm afraid you'll have to create a translation for your Projection (unless you hardcode that title in the view using T).
To make a PO file work I would need to overwrite the Shape to ensure the Title is written out in T(title) right, or is that already ensured by Orchard?

I understand that Localized content is getting some work done for 1.9 by Jetski I believe. Perhaps he has given this a thought.
Developer
Sep 29, 2014 at 2:47 AM
Yes, you would have to override a shape template in order to use translations from PO. Alternatively, you could implement a token provider as I mentioned and implemenet a shape table provider for the Parts_Title shape, where you would process the value of the TitlePart using the tokenizer. Then again, you could do all that from a shape override.