We have moved to GitHub Issues
Created by Anders Brohus 27 May 2018, 17:59:03 Updated by Sebastiaan Janssen 28 Jun 2018, 17:47:16Tags: Up For Grabs PR
The new info tab looks and works great! :) But accidently i was looking at one of our client's website and saw that it was in english even through the backend language was danish, so i began looking for the lines in the xml file containing all the translations, but i could not find them, so i created an issue on Our, where @JanSkovgaard told me that it was hardcoded.
So that is what this is all about making these lines of text translateable :)
I think the problem is that everybody can add audit events with any text they want (from their custom code).
All of the messages you see like "performed by user" are just spread out over the codebase (see screenshot). I don't think it's feasible to create all of these as translatable items, they're not actually labels like the other UI events, they are really just messages that come from the log.
That said, it could definitely be good to normalize the messages that the core puts in there and replace them with translations from the xml files instead.
We would love some help with that, here's an example of localizing something:
If you have variables you need to pass into the translation file, you can do it something like this:
Services.TextService.Localize("speechBubbles/operationSavedHeader", myVariable, secondVariable)
The xml would look something like this:
Nice thanks @sebastiaan :)
If it's possible i would like to try make this PR :)
It will be a fun way to start digging deeper into the Core :D
Awesome, go for it!
Thanks will do tonight :)
@andersbrohus I'm not 100% sure about this, as I haven't actually played around with this part of Umbraco before. But I would do something like the following:
ServiceContextclass is responsible for initializing the various services - eg. the content service is initialized here: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Services/ServiceContext.cs#L240
From what I can tell, this is the only place that the
ContentService class is initialized.
The localized text service is initialized a bit longer up the file, and is available through
_localizedTextService.Value. I would pass that as an additional parameter to the content service.
Add that additional parameter (of the type
ILocalizedTextService) to the constructor of the
ContentService class. You'll find the implementation here: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Services/ContentService.cs#L38
Store the localized text service in a private field within the
ContentService class so that you can access it from methods within the class
I haven't looked at the other services, but it should be somewhat the same
Test the changes
Create pull request
Klap dig selv på skulderen ;)
Also, don't be afraid to create the pull request. Even if you're not totally sure, the HQ is very helpful getting it merged, and comes with pointers for improving the code if necessary ;)
Thanks alot @abjerner now i have work to do for the rest of the night :D
Woohoo first PR is here! :)
Keep in mind that this is still work in progress as i still need to make some textes translateable :)
So i guess this is done :)
Have worked for two days now and it's really good! :)
Backwards Compatible: True
Fix Submitted: Pull request
Due in version: 7.12.0