Bug 53641 - "New Solution" dialogs are unlocalized.
Summary: "New Solution" dialogs are unlocalized.
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: IDE localization (show other bugs)
Version: 6.3 (15.1)
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 15.4
Assignee: Matt Ward
URL:
Depends on:
Blocks:
 
Reported: 2017-03-21 12:18 UTC by Lukas Chaloupka (Moravia IT)
Modified: 2017-10-03 09:57 UTC (History)
7 users (show)

See Also:
Tags: Globalization,15.4candidate
Is this bug a regression?: ---
Last known good build:


Attachments
s/s (5.25 MB, application/x-zip-compressed)
2017-03-23 11:20 UTC, Lukas Chaloupka (Moravia IT)
Details
s/s (4.93 MB, application/x-zip-compressed)
2017-03-23 11:20 UTC, Lukas Chaloupka (Moravia IT)
Details

Description Lukas Chaloupka (Moravia IT) 2017-03-21 12:18:55 UTC
Many "New Solution" dialogs are unlocalized. See attached screenshots.
Comment 1 Greg Munn 2017-03-22 17:08:48 UTC
No screenshots are attached.
Comment 2 Lukas Chaloupka (Moravia IT) 2017-03-23 11:20:05 UTC
Created attachment 20733 [details]
s/s
Comment 3 Lukas Chaloupka (Moravia IT) 2017-03-23 11:20:27 UTC
Created attachment 20734 [details]
s/s
Comment 4 Lukas Chaloupka (Moravia IT) 2017-04-12 13:25:36 UTC
Screenshots attached now.
Comment 5 Matt Ward 2017-06-08 13:56:45 UTC
The problem seems to be that the project templates in md-addins are not translated. Project templates from the monodevelop repository are translated.

The project templates are read by code in MonoDevelop and that attempts to translate the templates using code similar to:

    this.name = addin.Localizer.GetString (this.nonLocalizedName);

The Localizer object here is always the DefaultAddinLocalizer which just calls Gettextcatalog.GetString. For addins in md-addins we need to use the TranslationCatalog.GetString method instead.

	class DefaultAddinLocalizer: IAddinLocalizer
	{
		public string GetString (string id)
		{
			return GettextCatalog.GetString (id);
		}
	}

So presumably a way to fix this is for each addin in md-addins to somehow override the default localizer.

The RuntimeAddin's Load method creates the localizer based on information stored in the AddinDescription. However it looks like the type used cannot be overridden if the addin is using attributes to define its addin info. The addin scanner does:


AddinLocalizerGettextAttribute locat = (AddinLocalizerGettextAttribute) reflector.GetCustomAttribute (asm, typeof(AddinLocalizerGettextAttribute), false);
if (locat != null) {
	ExtensionNodeDescription node = new ExtensionNodeDescription ();
	node.SetAttribute ("type", "Gettext");
if (!string.IsNullOrEmpty (locat.Catalog))
	node.SetAttribute ("catalog", locat.Catalog);
if (!string.IsNullOrEmpty (locat.Location))
	node.SetAttribute ("location", locat.Location);
	config.Localizer = node;
}

So the type is always set to Gettext. So Mono addins I guess would need to be changed to not override that. Then a custom localizer can be created and used by all addins in md-addins, apart from Xamarin.Ide, that just calls TranslationCatalog.GetString. Xamarin.Ide seems to define localizer information so the translation catalogs can be used.
Comment 6 Matt Ward 2017-06-08 16:19:22 UTC
Other problems here are:

1) Categories defined in md-addins are not translated (e.g. General and Library). They may not be translated in monodevelop either - just luck that something else defines these strings. I cannot see some categories defined in the .po files. I am guessing that the extension attribute should have used an underscore for this to work.

2) Some of the project template descriptions use CDATA blocks and are not translated since the CDATA section is removed when it is passed to the localizer. I would guess we need to change the parser which extracts the data to remove the CDATA blocks when generating the master .po file.
Comment 7 Matt Ward 2017-06-09 16:52:55 UTC
Partial fix here:

https://github.com/xamarin/md-addins/pull/2077
Comment 8 xamarin-release-manager 2017-06-12 15:46:16 UTC
Fixed in version 7.2.0.111 (master)

Author: Matt Ward
Commit: 8447a1c13c7a54a73cd04212d9e06a382daa6216 (xamarin/md-addins)
Included in Commit: 9658bec037e8b3734c86d1efb94a825fc33b8844 (mono/monodevelop)
Comment 9 Matt Ward 2017-06-12 15:47:31 UTC
Re-opening this for now.

The CDATA fix has not yet been merged. The project template categories in md-addins are also not currently registered for translations either.
Comment 10 Matt Ward 2017-06-12 18:21:43 UTC
MonoDevelop commit: 04b5b9dfb4d1fe9a0241b1eb374c3c5e69faaf18 now has the CDATA fix and the project template categories in md-addins are now registered for translations.

The underlying bugs are fixed however there will still be some text, such as the project template categories and the project template descriptions that use CDATA, which is not yet translated in the New Project dialog since it is missing from the messages.po file or there are no associated translations in the language .po files. Other problems are that some of the project template descriptions have been changed recently so the strings in messages.po do not match the strings being used in md-addins. Although these descriptions do not typically work since they contain CDATA so no matches are found anyway.
Comment 11 Marius Ungureanu 2017-06-13 15:28:09 UTC
Newest loc drop has the strings stated by Matt.
Comment 12 Lluis Sanchez 2017-06-14 15:25:12 UTC
Closing since the strings are now localizable. We just need updated translations.
Comment 14 Matt Ward 2017-07-24 13:35:50 UTC
This looks to me as though the translations need to be updated since the failing strings are marked as fuzzy. The fuzzy strings are not used in the UI and need to be fixed by a tranlsator before they are available.

If the fuzzy strings are fixed in the translation to be non-fuzzy then the are correctly translated in the New project dialog. I tried making the .NET Core category names and one of the project template names non-fuzzy and rebuilding the strings were translated. So it just looks to me as though the translations need to be updated.
Comment 15 Matt Ward 2017-08-10 18:33:41 UTC
This is looking better in VS 7.2 Preview (7.2 build 526) d15.4 branch.

There are still seems to be a problem with some .NET Core project template titles:

xUnit Test Project
ASP.NET Core Empty
ASP.NET Core Web App
ASP.NET Core Web API
ASP.NET Core Web App (Razor Pages)

It looks like the problem here is that the above project templates do not explicitly define a name but instead rely on the underlying project template's NuGet package to provide it. So presumably a fix here is to just add the name attribute to the .addin.xml files.

The Razor Pages one does not have a translation however - it does not seem to exist at all in the translations, presumably again because it is not using the name attribute in the .addin.xml file so the string was never extracted for translation.
Comment 16 Matt Ward 2017-08-14 10:55:34 UTC
The xUnit Test Project ASP.NET Core Empty and ASP.NET Core Web App project template names not being translated is fixed for master in this pull request:

https://github.com/mono/monodevelop/pull/2896

The ASP.NET Core Web API and ASP.NET Core Web App (Razor Pages) project template names are not currently being translated.
Comment 17 Matt Ward 2017-08-14 11:12:34 UTC
Pull request for d15-4:

https://github.com/mono/monodevelop/pull/2897
Comment 20 Marius Ungureanu 2017-08-23 15:38:41 UTC
The strings are awaiting translation from localization team side. The source strings should include both the two items.
Comment 21 Matt Ward 2017-09-06 20:39:22 UTC
The translations look OK on master. On the d15-4 branch those two strings are not currently being translated.
Comment 22 Matt Ward 2017-10-03 09:57:37 UTC
The two missing ASP.NET strings are fixed in 7.2.0.617 (d15-4)

Note You need to log in before you can comment on or make changes to this bug.