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

Errormessages in the wrong language #498

Open
@HugoRoss

Description

@HugoRoss

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions