📄 localization.vb
字号:
Imports System.Reflection
Imports System.Globalization
Imports System.Resources
Public Class Localization
' Create the resource manager to be used by the method.
Private Shared LocalizeRM = New ResourceManager("ReportUtil.Localization", System.Reflection.Assembly.GetExecutingAssembly())
'The line preceding function declaration asserts that this function needs to have FullTrust rights
' even though it is called by a process that only has Execution rights.
'
'Also, the following line is required in AssemblyInfo.vb in order for the assert to work:
'
' <Assembly: Security.AllowPartiallyTrustedCallers()>
' This shared method returns the localized version of the string identifier that is passed to it.
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Assert, Name:="FullTrust")> _
Public Shared Function LocalizedString(ByVal stringIdentifier As String, ByVal language As String) As String
Try
' Create a CultureInfo object using the specified language.
Dim currentCulture = New CultureInfo(language)
' Use the CultureInfo object to return the appropriate string
' from the resource manager.
Return LocalizeRM.GetString(stringIdentifier, currentCulture)
Catch ex As System.Exception
' Return an error message if the process fails.
Return ex.Message
End Try
End Function
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -