Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Errormessages in the wrong language #498

Open
HugoRoss opened this issue Oct 4, 2018 · 0 comments
Open

Errormessages in the wrong language #498

HugoRoss opened this issue Oct 4, 2018 · 0 comments
Labels

Comments

@HugoRoss
Copy link

HugoRoss commented Oct 4, 2018

The text of AlphaFS exceptions is returned in the OS language instead of the language of Thread.CurrentThread.CurrentUICulture:

Imports System.Globalization
Imports System.Threading
Imports System.Windows.Forms
Imports Alphaleonis.Win32.Filesystem
Imports SysIO = System.IO

Module Module1

    Sub Main()
        'On a German Windows...
        Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US")
        Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture
        Directory.CreateDirectory("C:\Temp") 'Ensure folder exists
        File.WriteAllText("C:\Temp\Foo.txt", "Some text...") 'Ensure file exists
        Try
            Directory.CreateDirectory("C:\Temp\Foo.txt")
        Catch ex As Exception
            Clipboard.SetText(ex.Message)
            MsgBox(ex.Message) 'Displays "(183) Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist: [C:\Temp\Foo.txt]"
        End Try
        Try
            SysIO.Directory.CreateDirectory("C:\Temp\Foo.txt")
        Catch ex As Exception
            Clipboard.SetText(ex.Message)
            MsgBox(ex.Message) 'Displays "Cannot create "C:\Temp\Foo.txt" because a file or directory with the same name already exists."
        End Try
    End Sub

End Module
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants