Skip to content

Commit 2a74e8c

Browse files
committed
Fix resource resolving issue
1 parent 8b67880 commit 2a74e8c

4 files changed

Lines changed: 31 additions & 15 deletions

File tree

source/IdentityServer3.Contrib.Localization.UI/IdentityServer3.Contrib.Localization.UI.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@
9393
<Target Name="AfterBuild">
9494
</Target>
9595
-->
96+
<PropertyGroup>
97+
<PostBuildEvent>if $(ConfigurationName) == Release (
98+
if not exist "$(SolutionDir)..\packages" mkdir "$(SolutionDir)..\packages"
99+
"$(SolutionDir)..\tools\nuget.exe" pack "$(SolutionDir)IdentityServer3.Contrib.Localization.UI\IdentityServer3.Contrib.Localization.UI.nuspec" -OutputDirectory "$(SolutionDir)..\packages"
100+
)</PostBuildEvent>
101+
</PropertyGroup>
96102
<Choose>
97103
<When Condition="$(TargetFrameworkIdentifier) == '.NETCore'">
98104
<ItemGroup>
@@ -191,10 +197,4 @@
191197
</ItemGroup>
192198
</When>
193199
</Choose>
194-
<PropertyGroup>
195-
<PostBuildEvent>if $(ConfigurationName) == Release (
196-
if not exist "$(SolutionDir)..\packages" mkdir "$(SolutionDir)..\packages"
197-
"$(SolutionDir)..\tools\nuget.exe" pack "$(SolutionDir)IdentityServer3.Contrib.Localization.UI\IdentityServer3.Contrib.Localization.UI.nuspec" -OutputDirectory "$(SolutionDir)..\packages"
198-
)</PostBuildEvent>
199-
</PropertyGroup>
200200
</Project>

source/IdentityServer3.Contrib.Localization.UI/IdentityServer3.Contrib.Localization.UI.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>IdentityServer3.Contrib.Localization.UI</id>
5-
<version>1.0.0</version>
5+
<version>1.0.1</version>
66
<title>Thinktecture IdentityServer3 - Localization.UI</title>
77
<authors>Norbert Eder (MARMIND)</authors>
88
<licenseUrl>https://github.com/marmind/IdentityServer3.Contrib.Localization.UI/blob/master/LICENSE</licenseUrl>
99
<projectUrl>https://github.com/marmind/IdentityServer3.Contrib.Localization.UI</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1111
<description>Contrib implementation of IViewLoader for IdentityServer3 views in multiple languages</description>
12-
<releaseNotes>Working release.</releaseNotes>
12+
<releaseNotes>Fixed resource resolving issue</releaseNotes>
1313
<tags>IdentityServer3, i18n, Localize, UI</tags>
1414
<dependencies>
1515
<dependency id="Thinktecture.IdentityServer3" version="1.6.1" />

source/IdentityServer3.Contrib.Localization.UI/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following
@@ -8,9 +7,9 @@
87
[assembly: AssemblyTitle("IdentityServer3.Contrib.Localization.UI")]
98
[assembly: AssemblyDescription("")]
109
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
10+
[assembly: AssemblyCompany("UPPER Network GmbH / MARMIND")]
1211
[assembly: AssemblyProduct("IdentityServer3.Contrib.Localization.UI")]
13-
[assembly: AssemblyCopyright("Copyright © 2015")]
12+
[assembly: AssemblyCopyright("Copyright © UPPER Network GmbH 2015")]
1413
[assembly: AssemblyTrademark("")]
1514
[assembly: AssemblyCulture("")]
1615

@@ -32,5 +31,5 @@
3231
// You can specify all the values or you can default the Build and Revision Numbers
3332
// by using the '*' as shown below:
3433
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
34+
[assembly: AssemblyVersion("1.0.1.0")]
35+
[assembly: AssemblyFileVersion("1.0.1.0")]

source/IdentityServer3.Contrib.Localization.UI/TranslatorHelper.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.IO;
4+
using System.Reflection;
35
using System.Threading;
46
using SecondLanguage;
57

@@ -34,9 +36,13 @@ public static TranslatorHelper Instance
3436

3537
private void Init()
3638
{
37-
var files = Directory.GetFiles("Resources", "*.po", SearchOption.AllDirectories);
39+
var resPath = Path.Combine(AssemblyDirectory, "resources");
40+
Console.WriteLine("Resource path: " + resPath);
41+
42+
var files = Directory.GetFiles(resPath, "*.po", SearchOption.AllDirectories);
3843
foreach (string file in files)
3944
{
45+
Console.WriteLine(file);
4046
var translator = new Translator();
4147
translator.RegisterTranslation(file);
4248

@@ -64,5 +70,16 @@ public Translator GetTranslatorForCurrentCulture()
6470

6571
return translator;
6672
}
73+
74+
private string AssemblyDirectory
75+
{
76+
get
77+
{
78+
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
79+
var uri = new UriBuilder(codeBase);
80+
string path = Uri.UnescapeDataString(uri.Path);
81+
return Path.GetDirectoryName(path);
82+
}
83+
}
6784
}
6885
}

0 commit comments

Comments
 (0)