1

I know, I can add statements for different languages like this

<Resources>
    <Resource Language="en-us">
    <Resource Language="de-de">
</Resources>

But how can I give my app different names for different languages like "My US App" and my "My DE App"?

Thank you!

P.S. I found nothing in the net about this question. FYI, I don't use Visual Studio.

Thomas
  • 41
  • 3
  • You may find [this sample](https://github.com/microsoft/Xbox-ATG-Samples/tree/main/UWPSamples/System/NLSAndLocalizationUWP) useful. – Chuck Walbourn May 02 '23 at 18:58

1 Answers1

0

This could be done using the localization mechanism of UWP. I noticed that you mentioned that you are not using VS. You might need to create so necessary files by yourself.

  1. Create a Strings folder inside the Project folder.
  2. Under Strings, create a new sub-folder and name it en-US. You could create other sub-folders like de-DE and fr-FR for different language.
  3. Under en-US, create a new Resources File (.resw) and name it "Resources.resw". The Resources File (.resw) is a template in the Visual Studio. You need to create such file by yourself.
  4. Add key-value data in the Resources.resw file for name. For example, the key is AppDisplayName and the value is En-ValueTitle.
  5. Open your manifest file, under Applications-uap:VisualElements node, find DisplayName element and change its value as ms-resource:AppDisplayName.

Now your app will use the corresponding AppDisplayName value you defined in the Resources.resw file as the app name when you set the different default language for your app.

Here the Resources.resw file opened via notepad:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="AppDisplayName" xml:space="preserve">
    <value>En-ValueTitle</value>
  </data>
</root>
Roy Li - MSFT
  • 8,043
  • 1
  • 7
  • 13
  • Thank you very much! I'll try this as soon as I'm back home. – Thomas May 07 '23 at 10:50
  • @Thomas Have you tried it? – Roy Li - MSFT May 17 '23 at 07:16
  • No, not yet. I’m currently very busy with another project. But today is father‘s day in Germany and I hope I’m able to try it today if no one is going to occupy me ;-). I’ll update this thread then. – Thomas May 18 '23 at 08:18
  • Well, I spent a significant part of this holiday trying to get it running. No success. – Thomas May 19 '23 at 07:47
  • @Thomas So where is the issue? – Roy Li - MSFT May 19 '23 at 07:56
  • I created the resources.resw files as mentioned. They get installed in the Strings folder. I tried different locations (just below the app's folder and in the Resources folder). I changed the manifest file from within the MSIX packaging tool. Trying to install from the created .msix file always says that it tries to install an app named "ms-resource:AppDisplayName". Tools used: Inno setup and the MSIX packaging tool to create the msix file for the MS Store. I'm desperate. Please help! – Thomas May 19 '23 at 07:58
  • @Thomas It seems the resources.resw you created is not loaded correctly. Not sure if the issue is related to the location or the resources.resw file itself. Maybe you could directly use the resources.resw file from the official sample to test https://github.com/microsoft/Windows-universal-samples/tree/main/Samples/ApplicationResources/shared/strings. – Roy Li - MSFT May 19 '23 at 08:51
  • @Thomas The best way is doing this in Visual Studio. – Roy Li - MSFT May 19 '23 at 08:52
  • Thanks for your answers! How can I use Visual Studio when I use Xojo for development? – Thomas May 19 '23 at 09:35
  • @Thomas Just do the localization work in VS. Like creating a resources.resw file in the correct location and adding values. After you've done it, you can close VS and switch back to your development tool as usual. – Roy Li - MSFT May 19 '23 at 09:56
  • @Thomas Any updates about your issue? – Roy Li - MSFT Jun 02 '23 at 07:55
  • Sorry, no not yet. I'm still busy with other projects. But I promise, I'll keep you updated. – Thomas Jun 02 '23 at 08:27