C
C#2mo ago
wildREA

Manually Showing MainWindow.xaml In App.xaml.cs (Dependency Injection)

Hey! My code is supposed to manually show MainWindow.xaml, but it doesn't if I remove StartupUri="MainWindow.xaml" and I get the error that is listed with details below with it. Without it, I get no error, so it must be my logic. The way I wrote it is because of dependency injection for AppLanguageServices. App.xaml
<Application x:Class="computerComponentsTracker.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application x:Class="computerComponentsTracker.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
App.xaml.cs
private static IServiceProvider? ServiceProvider;

protected override void OnStartup(StartupEventArgs e)
{
var serviceCollection = new ServiceCollection();

// Register services
serviceCollection.AddSingleton<IAppLanguageServices, AppLanguageServices>();
serviceCollection.AddTransient<ComponentUsage>();
serviceCollection.AddTransient<MainWindow>();
serviceCollection.AddTransient<Settings>();

// Build service provider
ServiceProvider = serviceCollection.BuildServiceProvider();

// Manually create and show MainWindow
var mainWindow = ServiceProvider.GetRequiredService<MainWindow>();
mainWindow?.Show();

base.OnStartup(e);
}
private static IServiceProvider? ServiceProvider;

protected override void OnStartup(StartupEventArgs e)
{
var serviceCollection = new ServiceCollection();

// Register services
serviceCollection.AddSingleton<IAppLanguageServices, AppLanguageServices>();
serviceCollection.AddTransient<ComponentUsage>();
serviceCollection.AddTransient<MainWindow>();
serviceCollection.AddTransient<Settings>();

// Build service provider
ServiceProvider = serviceCollection.BuildServiceProvider();

// Manually create and show MainWindow
var mainWindow = ServiceProvider.GetRequiredService<MainWindow>();
mainWindow?.Show();

base.OnStartup(e);
}
81 Replies
FusedQyou
FusedQyou2mo ago
This is WPF?
wildREA
wildREAOP2mo ago
System.Windows.Markup.XamlParseException: ''No matching constructor found on type 'computerComponentsTracker.MainWindow'. You can use the Arguments or FactoryMethod directives to construct this type.' Line number '6' and line position '9'.'
System.Windows.Markup.XamlParseException: ''No matching constructor found on type 'computerComponentsTracker.MainWindow'. You can use the Arguments or FactoryMethod directives to construct this type.' Line number '6' and line position '9'.'
internal static void RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
{
throw WrapException(e, lineInfo, baseUri);
}
internal static void RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
{
throw WrapException(e, lineInfo, baseUri);
}
Yes, it is WPF.
FusedQyou
FusedQyou2mo ago
You have to set MainWindow in the app
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

MainWindow = new MainWindow();
MainWindow.Show();
}
}
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

MainWindow = new MainWindow();
MainWindow.Show();
}
}
Just making and showing the window doesn't work, you have to explicitly replace the MainWindow property for it to work Otherwise it assumes it has to use StartupUri which would be required
wildREA
wildREAOP2mo ago
What about the ServiceProvider in my code line?
var mainWindow = ServiceProvider.GetRequiredService<MainWindow>();
mainWindow?.Show();
var mainWindow = ServiceProvider.GetRequiredService<MainWindow>();
mainWindow?.Show();
FusedQyou
FusedQyou2mo ago
Doesn't matter, you don't set MainWindow MainWindow is a property in Application, mainWindow is your local variable So set MainWindow, not mainWindow You can do whatever you want, you just have to set MainWindow inside the startup which you're not doing. You can use DI like you do now. @wildREA works?
wildREA
wildREAOP2mo ago
protected override void OnStartup(StartupEventArgs e)
{
var serviceCollection = new ServiceCollection();

// Register services
serviceCollection.AddSingleton<IAppLanguageServices, AppLanguageServices>();
serviceCollection.AddTransient<ComponentUsage>();
serviceCollection.AddTransient<MainWindow>();
serviceCollection.AddTransient<Settings>();

// Build service provider
ServiceProvider = serviceCollection.BuildServiceProvider();

// Manually create and show MainWindow
MainWindow = new MainWindow(ServiceProvider);
MainWindow.Show();

base.OnStartup(e);
}
protected override void OnStartup(StartupEventArgs e)
{
var serviceCollection = new ServiceCollection();

// Register services
serviceCollection.AddSingleton<IAppLanguageServices, AppLanguageServices>();
serviceCollection.AddTransient<ComponentUsage>();
serviceCollection.AddTransient<MainWindow>();
serviceCollection.AddTransient<Settings>();

// Build service provider
ServiceProvider = serviceCollection.BuildServiceProvider();

// Manually create and show MainWindow
MainWindow = new MainWindow(ServiceProvider);
MainWindow.Show();

base.OnStartup(e);
}
This is my current line of code. It does not work and I need ServiceProvider as a required parameter, otherwise I assume I'd get an error due to a missing argument.
FusedQyou
FusedQyou2mo ago
private static IServiceProvider? ServiceProvider;

protected override void OnStartup(StartupEventArgs e)
{
var serviceCollection = new ServiceCollection();

// Register services
serviceCollection.AddSingleton<IAppLanguageServices, AppLanguageServices>();
serviceCollection.AddTransient<ComponentUsage>();
serviceCollection.AddTransient<MainWindow>();
serviceCollection.AddTransient<Settings>();

// Build service provider
ServiceProvider = serviceCollection.BuildServiceProvider();

// Manually create and show MainWindow
- var mainWindow = ServiceProvider.GetRequiredService<MainWindow>();
- mainWindow?.Show();
+ MainWindow = ServiceProvider.GetRequiredService<MainWindow>();
+ MainWindow?.Show();

base.OnStartup(e);
}
private static IServiceProvider? ServiceProvider;

protected override void OnStartup(StartupEventArgs e)
{
var serviceCollection = new ServiceCollection();

// Register services
serviceCollection.AddSingleton<IAppLanguageServices, AppLanguageServices>();
serviceCollection.AddTransient<ComponentUsage>();
serviceCollection.AddTransient<MainWindow>();
serviceCollection.AddTransient<Settings>();

// Build service provider
ServiceProvider = serviceCollection.BuildServiceProvider();

// Manually create and show MainWindow
- var mainWindow = ServiceProvider.GetRequiredService<MainWindow>();
- mainWindow?.Show();
+ MainWindow = ServiceProvider.GetRequiredService<MainWindow>();
+ MainWindow?.Show();

base.OnStartup(e);
}
This is all you need to do
wildREA
wildREAOP2mo ago
I already tried that, but I can try again and see if I maybe have had done something wrong.
FusedQyou
FusedQyou2mo ago
Worked for me 🤷‍♂️ In a minimal application this is all that's required for manual creation of the window @wildREA ?
wildREA
wildREAOP2mo ago
Sorry for forgetting to respond. I have a senior colleague try help me out, but we couldn't initially figure it out. He found me a YouTube video I should try and watch and see if it helps. The thing you gave me did not work.
FusedQyou
FusedQyou2mo ago
What does it say though Like, what's the error now
wildREA
wildREAOP2mo ago
The OnStartup method has 0 references, so it does not ever run at all.
FusedQyou
FusedQyou2mo ago
OnStartup is an overridden method which is called on app load. You can verify it by placing a breakpoint inside of it You don't have to call it WPF does it for you
wildREA
wildREAOP2mo ago
The problem is that it never runs since it, as I said, has 0 references, so something is mysteriously incorrect. I have interfaces setup for IServiceProvider, but since OnStartup doesn't run even with correct syntax for registering services, it cannot run since, well, it has no references as I mention again.
FusedQyou
FusedQyou2mo ago
How did you verify this? Did you place a breakpoint in it?
wildREA
wildREAOP2mo ago
I did it by using a breakpoint and generally reading that there aren't any references.
No description
FusedQyou
FusedQyou2mo ago
0 references at the top is something you should not be reading here This is an internal method you override and internal code calls it So this is not an issue with main window at this point, your method is not called
wildREA
wildREAOP2mo ago
Oh right, but it still never runs.
FusedQyou
FusedQyou2mo ago
So what does this setting say in your csproj properties?
No description
FusedQyou
FusedQyou2mo ago
Also, are you starting the correct project? Make sure you have the project as the startup project
No description
FusedQyou
FusedQyou2mo ago
Something is either blocking this code from running because something else is run, or you didn't compile the changes at all
wildREA
wildREAOP2mo ago
No description
FusedQyou
FusedQyou2mo ago
If that doesn't solve it I suggest you delete the bin and obj folder from your project, recompile, and check again It would also help if you shared all the code and the exception more properly Also, this exception generally suggests you still use parameters somewhere where you should not use them I have only seen 0.01% of the code so I can only assume somewhere you have an Application/Window/Control constructor that takes parameters So you should verify that's not the case Would be nice if we could continue the conversation in a steady manner rather than having huge pauses by the way Unless your issue is resolved
wildREA
wildREAOP2mo ago
Is it okay with you if I enter a voice channel with you tomorrow after college? By the way, I had break for 30 minutes, so that's why there was such a huge pause.
FusedQyou
FusedQyou2mo ago
I see I don't want to join a voice channel because generally it won't improve the conversation I just want to have more context, like the current error and the code that is actually used here Also considering I asked you to check various things, such as the constructors, and I have no clue what the answer to those would be
wildREA
wildREAOP2mo ago
Here is my repo.
MODiX
MODiX2mo ago
FusedQyou
I have only seen 0.01% of the code so I can only assume somewhere you have an Application/Window/Control constructor that takes parameters
React with ❌ to remove this embed.
FusedQyou
FusedQyou2mo ago
-public MainWindow(IServiceProvider serviceProvider)
+public MainWindow()
-public MainWindow(IServiceProvider serviceProvider)
+public MainWindow()
See how that changes things You'll have to add an explicit Initialize method in here and keep an empty constructor Generally you make factories because of this reason. Also something mentioned in the documentation @wildREA
wildREA
wildREAOP2mo ago
public static ComponentUsage componentUsage;
public Settings settings;
private IServiceProvider _serviceProvider;

// Empty constructor
public MainWindow()
{
InitializeComponent();
}

// Explicit initialization
public void Initialize(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
InitializePages(_serviceProvider);
InitializeComponentPage(); // Set default page
}
public static ComponentUsage componentUsage;
public Settings settings;
private IServiceProvider _serviceProvider;

// Empty constructor
public MainWindow()
{
InitializeComponent();
}

// Explicit initialization
public void Initialize(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
InitializePages(_serviceProvider);
InitializeComponentPage(); // Set default page
}
This is how it looks now, but it does not open the window.
FusedQyou
FusedQyou2mo ago
Does anything happen at all? Any errors? I can't imagine it just doesn't do anything unless you literally don't tell it to do anything, such as not showing the window at all
wildREA
wildREAOP2mo ago
I've manually coded it to show MainWindow, but it doesn't. It runs without errors, but no window nonetheless. I'm referring to your suggested changes.
FusedQyou
FusedQyou2mo ago
Next thing to do would be to verify it still gets to MainWindow?.Show() and see that it is non-null and calling it Also put a breakpoint inside the MainWindow's constructor to see if it's called Actually, I'll just clone your repo and check myself
wildREA
wildREAOP2mo ago
The breakpoint tells me that public MainWindow does not run and MainWindow?.Show(); is not null. Just fork it.
FusedQyou
FusedQyou2mo ago
It doesn't even run for me Like, doesn't even call the startup object
wildREA
wildREAOP2mo ago
Now we're in the same boat.
FusedQyou
FusedQyou2mo ago
You say it gets to the Show method though
wildREA
wildREAOP2mo ago
No, I have figured out that theOnStartup method does not run.
FusedQyou
FusedQyou2mo ago
I don't understand this then How can it not be null if it doesn't run Anyway the issue is your App isn't wrapped in a namespace
FusedQyou
FusedQyou2mo ago
You removed it by accident 7 days ago
No description
wildREA
wildREAOP2mo ago
Well, there is some progression. At least I have different errors now, of which are missing assembly references for IAppLanguageServices. This is just embarassing. Just for your information, I have break until 12 (XX:00).
FusedQyou
FusedQyou2mo ago
All good If you want I can add a pull request that fixes this I'm just confused why the conversation started off with a whole different issue that seemed to suggest it worked for you initially Or was this an old version by any chance? The error I had personally was something about settings not being registered by DI, which is a matter of specifying it in the service collection To be fair, WPF is dumb as hell for not properly erroring because it can't find the entry point. I would expect something to break here but instead it just ignores it
wildREA
wildREAOP2mo ago
Sure, go ahead. It was probably an older version. I have registered my services, and they should work, but yes, WPF is a work of deterred art.
FusedQyou
FusedQyou2mo ago
Sorry, I got quite busy so I'm not sure if I can contribute to the change. I hope the fix is clear so maybe you can do it
wildREA
wildREAOP2mo ago
It's fine, I've already implemented the changes. I've defined IAppLanguageServices and added the namespace, of which caused the language service assembly references to be missing. The problem is, the issue still persists with not receiving any errors, while not having the MainWindow show. Listen, you can contribute further if you'd like, but I'm done for today at 15:30 (XX:30), so I'll check on this either later today if I have time or tomorrow.
FusedQyou
FusedQyou2mo ago
I'm quite busy at work currently but I can take a look at it later
cned
cned2mo ago
I might actually be able to help with this one, as I ran into this this week. There are 2 really serious bugs in WPF. The first is that if you set <AssemblyName> anywhere in your cproj (or in any other Directory.Build.props or anything), the build will fail to bind any XAML elements that are referencing the current assembly. To fix this, you need to make that property depended on "_TargetAssemblyProjectName" not being set. The second is that if you have exactly one resource in your App.xaml file, it will just... not compile your App.xaml at all. To fix this you need to add a second resource to your App.xaml resource dictionary. I went with a super passive agressive "<system:String>" resource, but any resource will do. Both of these can cause the constructor of your main window to throw an exception that the WPF framework tends to swallow up, which would explain why code in your OnStartup appears never to run.
wildREA
wildREAOP5w ago
I have no <AssemblyName> tag in my .csproj file and I have two <ResourceDictionary> in my App.xaml. It was like that before as well, so it still does not run. .csproj
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<StartupObject>computerComponentsTracker.App</StartupObject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.4" />
<PackageReference Include="LiveCharts" Version="0.9.7" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
<PackageReference Include="OpenHardwareMonitor" Version="0.9.6" />
<PackageReference Include="Syncfusion.SfGrid.WPF" Version="28.2.3" />
<PackageReference Include="Syncfusion.SfProgressBar.WPF" Version="28.2.3" />
<PackageReference Include="System.Management" Version="9.0.1" />
</ItemGroup>

<ItemGroup>
<Folder Include="Images\" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<StartupObject>computerComponentsTracker.App</StartupObject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.4" />
<PackageReference Include="LiveCharts" Version="0.9.7" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
<PackageReference Include="OpenHardwareMonitor" Version="0.9.6" />
<PackageReference Include="Syncfusion.SfGrid.WPF" Version="28.2.3" />
<PackageReference Include="Syncfusion.SfProgressBar.WPF" Version="28.2.3" />
<PackageReference Include="System.Management" Version="9.0.1" />
</ItemGroup>

<ItemGroup>
<Folder Include="Images\" />
</ItemGroup>

</Project>
App.xaml
<Application x:Class="computerComponentsTracker.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Default language -->
<ResourceDictionary Source="Resources/Strings.xaml"/>
<!-- Russian language -->
<ResourceDictionary Source="Resources/Strings.ru.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
<Application x:Class="computerComponentsTracker.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Default language -->
<ResourceDictionary Source="Resources/Strings.xaml"/>
<!-- Russian language -->
<ResourceDictionary Source="Resources/Strings.ru.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
FusedQyou
FusedQyou5w ago
I told you the application was missing namespaces You never fixed this
MODiX
MODiX5w ago
FusedQyou
Anyway the issue is your App isn't wrapped in a namespace
React with ❌ to remove this embed.
FusedQyou
FusedQyou5w ago
I made a pull request that fixes this. If you merge it the application will work again (in the development branch) https://github.com/wildREA/computerComponentsTracker/pull/4 Additionally, I fixed an issue with your DI setup that causes an additional exception because IAppLanguageServices relies on Application and it was not regisered. Please reconsider the way you have set up your services because passing the whole application in it is very bad practice due to excessive coupling.
GitHub
Fixes regarding the startup of the application by RoyDefined · Pull...
This pull request fixes two issues that cause the application to have issues during startup. Due to a missing namespace in App.xaml.cs the application could not find the main entrypoint. Due to mi...
FusedQyou
FusedQyou5w ago
@wildREA Tested locally and after a small delay the window shows
wildREA
wildREAOP5w ago
I had already added a namespace. Anyways, it still does not show MainWindow.
FusedQyou
FusedQyou5w ago
If you added the namespace then how is it possible for my pull request to make these changes? It would not have been required. None of your commits have ever fixed it. The last commit was from 4 days ago.
wildREA
wildREAOP5w ago
I never pushed my changes since.
FusedQyou
FusedQyou5w ago
I can't help you based on guesswork. You have to commit these things. Also, for me the application starts when using a fresh repo. Maybe try deleting your bin and obj folder and try again. Note that there's a substantial delay during startup, possible from all the IO operations happening
FusedQyou
FusedQyou5w ago
No description
wildREA
wildREAOP5w ago
Does the language feature work?
FusedQyou
FusedQyou5w ago
I don't know what that is. I only fixed the whole issue with the startup I can give you a bit of additional help, but you do need to explain what must be looked at then
wildREA
wildREAOP5w ago
You have to move your mouse over the settings button and click it, then you can select a language under textblock a comboboxitem. You gotta click apply for it to change.
FusedQyou
FusedQyou5w ago
Well you see, when setting a breakpoint in the application you can see it finds the new language when I change the dropdown value. Try it yourself
No description
FusedQyou
FusedQyou5w ago
That said, I don't see any visual changes when I do this. I assume you have to update the UI somehow if you expect the strings to display Russian
wildREA
wildREAOP5w ago
I'll push the new changes. By the way, it works. I basically had nothing to do with the actual coding or anything like that, I had to CREATE A NEW FOLDER for the project. The namespace might have surely worked, but after that, it only showed up after I made the new folder.
FusedQyou
FusedQyou5w ago
I don't see how a new folder fixes anything I think you have a bunch of changes still lying around without you noticing them. No pending commits ready to be pushed? Are you using a GUI like Github Desktop for changes or just the command line?
wildREA
wildREAOP5w ago
Visual Studio Enterprise has a built-in Git feature. I had no lying commits.
FusedQyou
FusedQyou5w ago
Not sure then I feel like you confuse yourself on this and it's more an XY problem thing Like, it wasn't the folder but rather something you did around it A fresh repo should work, assuming you have my fixes
wildREA
wildREAOP5w ago
It works now, I didn't get to mention it and the ResourceDictionary work now as well.
FusedQyou
FusedQyou5w ago
Nice Well, I have everything set up locally now so if there's anything else I can take a look if needed
wildREA
wildREAOP5w ago
Are you native or proficient in a language other than English?
FusedQyou
FusedQyou5w ago
I'm Dutch myself, I can somewhat read German but I definitely prefer just English
wildREA
wildREAOP5w ago
Could you perhaps help with translation for Dutch? I can do the German myself since I speak it as well at a comprehensible level.
FusedQyou
FusedQyou5w ago
Sure, I can contribute with translations but it also depends on the size. I don't have a lot of time apart from these small bits whilst at work, and the rest I'd rather spend on personal learning Is it just the strings in the Resources folder?
wildREA
wildREAOP5w ago
Strings.nl.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<sys:String x:Key="SettingsTitle">Settings</sys:String>
<sys:String x:Key="ChangeSettings">Change the settings for the application</sys:String>
<sys:String x:Key="ChangeTheme">Theme</sys:String>
<sys:String x:Key="ChangeLanguage">Language</sys:String>
<sys:String x:Key="ChangeNetworkAdapter">Network adapter</sys:String>
<sys:String x:Key="ChangeRefreshRate">Refresh rate</sys:String>
<sys:String x:Key="LightTheme">Light</sys:String>
<sys:String x:Key="DarkTheme">Dark</sys:String>
<sys:String x:Key="EnglishLanguage">English</sys:String>
<sys:String x:Key="RussianLanguage">Русский</sys:String>
<sys:String x:Key="AutoNetwork">Auto</sys:String>
<sys:String x:Key="EthernetNetwork">Ethernet</sys:String>
<sys:String x:Key="WiFiNetwork">Wi-Fi</sys:String>
<sys:String x:Key="SecondRefreshRate">Second</sys:String>
<sys:String x:Key="MillisecondRefreshRate">Millisecond</sys:String>
</ResourceDictionary>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<sys:String x:Key="SettingsTitle">Settings</sys:String>
<sys:String x:Key="ChangeSettings">Change the settings for the application</sys:String>
<sys:String x:Key="ChangeTheme">Theme</sys:String>
<sys:String x:Key="ChangeLanguage">Language</sys:String>
<sys:String x:Key="ChangeNetworkAdapter">Network adapter</sys:String>
<sys:String x:Key="ChangeRefreshRate">Refresh rate</sys:String>
<sys:String x:Key="LightTheme">Light</sys:String>
<sys:String x:Key="DarkTheme">Dark</sys:String>
<sys:String x:Key="EnglishLanguage">English</sys:String>
<sys:String x:Key="RussianLanguage">Русский</sys:String>
<sys:String x:Key="AutoNetwork">Auto</sys:String>
<sys:String x:Key="EthernetNetwork">Ethernet</sys:String>
<sys:String x:Key="WiFiNetwork">Wi-Fi</sys:String>
<sys:String x:Key="SecondRefreshRate">Second</sys:String>
<sys:String x:Key="MillisecondRefreshRate">Millisecond</sys:String>
</ResourceDictionary>
Yes, just this. Foreign words like Wi-Fi and Ethernet does not have to be translated if the language does not necessarily have a translation for it.
FusedQyou
FusedQyou5w ago
Words like Wi-Fi and Ethernet are words we use ourselves
wildREA
wildREAOP5w ago
Same here. For Russian, Danish, German, Lithuanian, Polish, and some other languages that aren't English-based mostly.
FusedQyou
FusedQyou5w ago
I'll make a String.nl.xaml file and make sure it becomes an option in the drop down
wildREA
wildREAOP5w ago
Alright, then I'll do the de, lt, pl, da, and tr. Thanks in advance.
FusedQyou
FusedQyou5w ago
No problem It's nice to add some points to the account in terms of outside contribution
wildREA
wildREAOP4w ago
For sure. I even had my friend next to me right now help me beforehand, that's the other guy in the contribution list. He'll do the tr (Turkish) translation. @FusedQyou I translated Strings.xaml. Is my nl translation correct? Strings.nl.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<sys:String x:Key="SettingsTitle">Instellingen</sys:String>
<sys:String x:Key="ChangeSettings">Wijzig de instellingen voor de applicatie</sys:String>
<sys:String x:Key="ChangeTheme">Thema</sys:String>
<sys:String x:Key="ChangeLanguage">Taal</sys:String>
<sys:String x:Key="ChangeNetworkAdapter">Netwerkadapter</sys:String>
<sys:String x:Key="ChangeRefreshRate">Vernieuwingssnelheid</sys:String>
<sys:String x:Key="LightTheme">Licht</sys:String>
<sys:String x:Key="DarkTheme">Donker</sys:String>
<sys:String x:Key="ArabicSaudiLanguage">Arabisch (Saoedi-Arabië)</sys:String>
<sys:String x:Key="FarsiIraqLanguage">Perzisch (Irak)</sys:String>
<sys:String x:Key="GermanLanguage">Duits</sys:String>
<sys:String x:Key="GreekLanguage">Grieks</sys:String>
<sys:String x:Key="EnglishLanguage">Engels</sys:String>
<sys:String x:Key="FrenchLanguage">Frans</sys:String>
<sys:String x:Key="HebrewLanguage">Hebreeuws</sys:String>
<sys:String x:Key="HindiLanguage">Hindi</sys:String>
<sys:String x:Key="KoreanLanguage">Koreaans</sys:String>
<sys:String x:Key="ItalianLanguage">Italiaans</sys:String>
<sys:String x:Key="KurdishLanguage">Koerdisch</sys:String>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<sys:String x:Key="SettingsTitle">Instellingen</sys:String>
<sys:String x:Key="ChangeSettings">Wijzig de instellingen voor de applicatie</sys:String>
<sys:String x:Key="ChangeTheme">Thema</sys:String>
<sys:String x:Key="ChangeLanguage">Taal</sys:String>
<sys:String x:Key="ChangeNetworkAdapter">Netwerkadapter</sys:String>
<sys:String x:Key="ChangeRefreshRate">Vernieuwingssnelheid</sys:String>
<sys:String x:Key="LightTheme">Licht</sys:String>
<sys:String x:Key="DarkTheme">Donker</sys:String>
<sys:String x:Key="ArabicSaudiLanguage">Arabisch (Saoedi-Arabië)</sys:String>
<sys:String x:Key="FarsiIraqLanguage">Perzisch (Irak)</sys:String>
<sys:String x:Key="GermanLanguage">Duits</sys:String>
<sys:String x:Key="GreekLanguage">Grieks</sys:String>
<sys:String x:Key="EnglishLanguage">Engels</sys:String>
<sys:String x:Key="FrenchLanguage">Frans</sys:String>
<sys:String x:Key="HebrewLanguage">Hebreeuws</sys:String>
<sys:String x:Key="HindiLanguage">Hindi</sys:String>
<sys:String x:Key="KoreanLanguage">Koreaans</sys:String>
<sys:String x:Key="ItalianLanguage">Italiaans</sys:String>
<sys:String x:Key="KurdishLanguage">Koerdisch</sys:String>
<sys:String x:Key="LithuanianLanguage">Litouws</sys:String>
<sys:String x:Key="DutchLanguage">Nederlands</sys:String>
<sys:String x:Key="JapaneseLanguage">Japans</sys:String>
<sys:String x:Key="PolishLanguage">Pools</sys:String>
<sys:String x:Key="PortugueseLanguage">Portugees</sys:String>
<sys:String x:Key="RussianLanguage">Russisch</sys:String>
<sys:String x:Key="ThaiLanguage">Thais</sys:String>
<sys:String x:Key="TurkishLanguage">Turks</sys:String>
<sys:String x:Key="ChineseLanguage">Chinees</sys:String>
<sys:String x:Key="LebaneseLanguage">Libanees</sys:String>
<sys:String x:Key="AutoNetwork">Automatisch</sys:String>
<sys:String x:Key="EthernetNetwork">Ethernet</sys:String>
<sys:String x:Key="WiFiNetwork">Wi-Fi</sys:String>
<sys:String x:Key="SecondRefreshRate">Seconden</sys:String>
<sys:String x:Key="MillisecondRefreshRate">Milliseconden</sys:String>
</ResourceDictionary>
<sys:String x:Key="LithuanianLanguage">Litouws</sys:String>
<sys:String x:Key="DutchLanguage">Nederlands</sys:String>
<sys:String x:Key="JapaneseLanguage">Japans</sys:String>
<sys:String x:Key="PolishLanguage">Pools</sys:String>
<sys:String x:Key="PortugueseLanguage">Portugees</sys:String>
<sys:String x:Key="RussianLanguage">Russisch</sys:String>
<sys:String x:Key="ThaiLanguage">Thais</sys:String>
<sys:String x:Key="TurkishLanguage">Turks</sys:String>
<sys:String x:Key="ChineseLanguage">Chinees</sys:String>
<sys:String x:Key="LebaneseLanguage">Libanees</sys:String>
<sys:String x:Key="AutoNetwork">Automatisch</sys:String>
<sys:String x:Key="EthernetNetwork">Ethernet</sys:String>
<sys:String x:Key="WiFiNetwork">Wi-Fi</sys:String>
<sys:String x:Key="SecondRefreshRate">Seconden</sys:String>
<sys:String x:Key="MillisecondRefreshRate">Milliseconden</sys:String>
</ResourceDictionary>
FusedQyou
FusedQyou4w ago
Yes, that looks exactly like how I would pronounce everything
wildREA
wildREAOP4w ago
I'll push it then to development.

Did you find this page helpful?