Skip to content

Commit

Permalink
Update example generated code section in README
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhelle authored May 20, 2019
1 parent 950b59d commit 650d301
Showing 1 changed file with 129 additions and 56 deletions.
185 changes: 129 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ A Visual Studio Custom Tool for generating a strongly typed helper class for acc
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18010
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -64,66 +64,110 @@ A Visual Studio Custom Tool for generating a strongly typed helper class for acc

// --------------------------------------------------------------------------------------------------
// <auto-generatedInfo>
// This code was generated by ResW File Code Generator (http://reswcodegen.codeplex.com)
// This code was generated by ResW File Code Generator (http://bit.ly/reswcodegen)
// ResW File Code Generator was written by Christian Resma Helle
// and is under GNU General Public License version 2 (GPLv2)
//
// This code contains a helper class exposing property representations
// of the string resources defined in the specified .ResW file
//
// Generated: 11/08/2012 22:41:22
// Generated: 05/20/2019 15:47:37
// </auto-generatedInfo>
// --------------------------------------------------------------------------------------------------
namespace App1.LocalizedResources
namespace App2
{
using Windows.ApplicationModel.Resources;

public partial class Resources


public sealed partial class Resources
{

private static ResourceLoader resourceLoader = new ResourceLoader();

private static ResourceLoader resourceLoader;
/// <summary>
/// Localized resource similar to "Test 1 value"
/// Get or set ResourceLoader implementation
/// </summary>
public static string Test1
public static ResourceLoader Resource
{
get
{
return resourceLoader.GetString("Test1");
if ((resourceLoader == null))
{
Resources.Initialize();
}
return resourceLoader;
}
set
{
resourceLoader = value;
}
}

/// <summary>
/// Localized resource similar to "Test 2 value"
/// Localized resource similar to "test"
/// </summary>
public static string Test
{
get
{
return Resource.GetString("Test");
}
}
/// <summary>
/// Localized resource similar to "test"
/// </summary>
public static string Test2
{
get
{
return resourceLoader.GetString("Test2");
return Resource.GetString("Test2");
}
}

/// <summary>
/// Localized resource similar to "Test 3 value"
/// Localized resource similar to "test"
/// </summary>
public static string Test3
{
get
{
return resourceLoader.GetString("Test3");
return Resource.GetString("Test3");
}
}
public static void Initialize()
{
string executingAssemblyName;
executingAssemblyName = Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName;
string[] executingAssemblySplit;
executingAssemblySplit = executingAssemblyName.Split(',');
executingAssemblyName = executingAssemblySplit[1];
string currentAssemblyName;
currentAssemblyName = typeof(Resources).AssemblyQualifiedName;
string[] currentAssemblySplit;
currentAssemblySplit = currentAssemblyName.Split(',');
currentAssemblyName = currentAssemblySplit[1];
if (executingAssemblyName.Equals(currentAssemblyName))
{
resourceLoader = ResourceLoader.GetForCurrentView("Resources");
}
else
{
resourceLoader = ResourceLoader.GetForCurrentView(currentAssemblyName + "/Resources");
}
}
}
}



**Example Generated Visual Basic Code**

'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.18010
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
Expand All @@ -137,49 +181,78 @@ A Visual Studio Custom Tool for generating a strongly typed helper class for acc

'--------------------------------------------------------------------------------------------------
'<auto-generatedInfo>
' This code was generated by ResW File Code Generator (http://reswcodegen.codeplex.com)
' This code was generated by ResW File Code Generator (http://bit.ly/reswcodegen)
' ResW File Code Generator was written by Christian Resma Helle
' and is under GNU General Public License version 2 (GPLv2)
'
' This code contains a helper class exposing property representations
' of the string resources defined in the specified .ResW file
'
' Generated: 11/12/2012 21:30:52
' Generated: 05/20/2019 15:48:18
'</auto-generatedInfo>
'--------------------------------------------------------------------------------------------------

Namespace AppVb.LocalizedStrings

Partial Public Class Resources

Private Shared resourceLoader As ResourceLoader = New ResourceLoader()

'''<summary>
'''Localized resource similar to "Test 1 value"
'''</summary>
Public Shared ReadOnly Property Test1() As String
Get
Return resourceLoader.GetString("Test1")
End Get
End Property

'''<summary>
'''Localized resource similar to "Test 2 value"
'''</summary>
Public Shared ReadOnly Property Test2() As String
Get
Return resourceLoader.GetString("Test2")
End Get
End Property

'''<summary>
'''Localized resource similar to "Test 3 value"
'''</summary>
Public Shared ReadOnly Property Test3() As String
Get
Return resourceLoader.GetString("Test3")
End Get
End Property
End Class
End Namespace

Partial Public NotInheritable Class Resources

Private Shared resourceLoader As ResourceLoader

'''<summary>
'''Get or set ResourceLoader implementation
'''</summary>
Public Shared Property Resource() As ResourceLoader
Get
If (resourceLoader Is Nothing) Then
Resources.Initialize
End If
Return resourceLoader
End Get
Set
resourceLoader = value
End Set
End Property

'''<summary>
'''Localized resource similar to "test"
'''</summary>
Public Shared ReadOnly Property Test() As String
Get
Return Resource.GetString("Test")
End Get
End Property

'''<summary>
'''Localized resource similar to "test"
'''</summary>
Public Shared ReadOnly Property Test2() As String
Get
Return Resource.GetString("Test2")
End Get
End Property

'''<summary>
'''Localized resource similar to "test"
'''</summary>
Public Shared ReadOnly Property Test3() As String
Get
Return Resource.GetString("Test3")
End Get
End Property

Public Shared Sub Initialize()
Dim executingAssemblyName As String
executingAssemblyName = Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName
Dim executingAssemblySplit() As String
executingAssemblySplit = executingAssemblyName.Split(Global.Microsoft.VisualBasic.ChrW(44))
executingAssemblyName = executingAssemblySplit(1)
Dim currentAssemblyName As String
currentAssemblyName = GetType(Resources).AssemblyQualifiedName
Dim currentAssemblySplit() As String
currentAssemblySplit = currentAssemblyName.Split(Global.Microsoft.VisualBasic.ChrW(44))
currentAssemblyName = currentAssemblySplit(1)
If executingAssemblyName.Equals(currentAssemblyName) Then
resourceLoader = ResourceLoader.GetForCurrentView("Resources")
Else
resourceLoader = ResourceLoader.GetForCurrentView(currentAssemblyName + "/Resources")
End If
End Sub
End Class

0 comments on commit 650d301

Please sign in to comment.