Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1009374/
Context: dotnet/android@0342fe5
Localize error and warning messages produced by
`Xamarin.Android.Tools.AndroidSdk.dll`.
We will be following the [.NET Resource Localization pattern][0] and
generating satellite assemblies using [`.resx` files][1], in particular
`src/Xamarin.Android.Tools.AndroidSdk/Properties/Resources.resx`.
`Resources.resx` is an XML file, and will contain `/root/data`
elements in which `//data/@name` will be a semantically meaningful
shorthand for the actual error message, followed by a `_`-separated
list of "parameter names" for the message, if the message has any
format string placeholders. The `//data/value` will
be the error or warning message:
<root>
<data name="InvalidMonodroidConfigFile_path_message" xml:space="preserve">
<value>An exception occurred while reading configuration file '{0}'. Exception: {1}</value>
<comment>
{0} - The path of the file being read.
{1} - The exception message of the associated exception.
</comment>
</data>
</root>
An optional `//data/comment` element may be provided to describe the
meaning within the `//data/value` element to translators.
When using Visual Studio or Visual Studio for Mac, changes to
`Resrouces.resx` will cause `Resources.Designer.cs` to be updated:
namespace Xamarin.Android.Tools.AndroidSdk.Properties {
internal partial class Resources {
internal static string InvalidMonodroidConfigFile_path_message {
get => …
}
}
}
The `Resources` members should be used to obtain all strings for use
in `logger()` calls:
logger (TraceLevel.Error, string.Format (Resources.InvalidMonodroidConfigFile_path_message, file, ex.Message));
When an MSBuild error or warning code is used with more than one
output string, then a semantically meaningful suffix should be used
to distinguish between the two.
Note that this infrastructure does not interoperate with C#6 string
interpolation. Any error or warning messages currently using C#6
string interpolation will need to use .NET 1.0-style format strings.
Our translation team doesn't work directly with `.resx` files.
Instead, the translation team works with [XLIFF files][2].
`Resources.resx` is converted into a set of
`src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.*.xlf`
files via `XliffTasks.targets` from the [dotnet/xliff-tasks][3] repo.
The `Resources.*.xlf` files should be automatically updated whenever
`Resources.resx` is updated.
[0]: https://docs.microsoft.com/dotnet/framework/resources/index
[1]: https://docs.microsoft.com/dotnet/framework/resources/creating-resource-files-for-desktop-apps#resources-in-resx-files
[2]: http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html
[3]: https://github.com/dotnet/xliff-tasks