Skip to content

Commit 83b2d2e

Browse files
committed
update deps to 2.0preview
1 parent 3b5c809 commit 83b2d2e

5 files changed

Lines changed: 182 additions & 184 deletions

File tree

src/WebLib/WebLib.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard1.6</TargetFramework>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55
<AssemblyName>WebLib</AssemblyName>
66
<PackageId>WebLib</PackageId>
77
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
@@ -14,10 +14,10 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="1.1.*" />
18-
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="1.1.*" />
19-
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="1.1.*" />
20-
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="1.1.*" />
17+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.0.0-*" />
18+
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.0.0-*" />
19+
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="2.0.0-*" />
20+
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="2.0.0-*" />
2121
</ItemGroup>
2222

2323
</Project>
Lines changed: 146 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,146 @@
1-
using System;
2-
using System.Collections.Concurrent;
3-
using System.IO;
4-
using System.Reflection;
5-
using System.Resources;
6-
using Microsoft.AspNetCore.Hosting;
7-
using Microsoft.Extensions.Options;
8-
9-
//https://github.com/aspnet/Localization/issues/139
10-
11-
namespace Microsoft.Extensions.Localization
12-
{
13-
/// <summary>
14-
/// An <see cref="IStringLocalizerFactory"/> that creates instances of <see cref="ResourceManagerStringLocalizer"/>.
15-
/// </summary>
16-
public class PatchedResourceManagerStringLocalizerFactory : IStringLocalizerFactory
17-
{
18-
private readonly IResourceNamesCache _resourceNamesCache = new ResourceNamesCache();
19-
private readonly ConcurrentDictionary<string, ResourceManagerStringLocalizer> _localizerCache =
20-
new ConcurrentDictionary<string, ResourceManagerStringLocalizer>();
21-
private readonly IHostingEnvironment _hostingEnvironment;
22-
private readonly string _resourcesRelativePath;
23-
24-
/// <summary>
25-
/// Creates a new <see cref="ResourceManagerStringLocalizer"/>.
26-
/// </summary>
27-
/// <param name="hostingEnvironment">The <see cref="IHostingEnvironment"/>.</param>
28-
/// <param name="localizationOptions">The <see cref="IOptions{LocalizationOptions}"/>.</param>
29-
public PatchedResourceManagerStringLocalizerFactory(
30-
IHostingEnvironment hostingEnvironment,
31-
IOptions<LocalizationOptions> localizationOptions)
32-
{
33-
if (hostingEnvironment == null)
34-
{
35-
throw new ArgumentNullException(nameof(hostingEnvironment));
36-
}
37-
38-
if (localizationOptions == null)
39-
{
40-
throw new ArgumentNullException(nameof(localizationOptions));
41-
}
42-
43-
_hostingEnvironment = hostingEnvironment;
44-
_resourcesRelativePath = localizationOptions.Value.ResourcesPath ?? string.Empty;
45-
if (!string.IsNullOrEmpty(_resourcesRelativePath))
46-
{
47-
_resourcesRelativePath = _resourcesRelativePath.Replace(Path.AltDirectorySeparatorChar, '.')
48-
.Replace(Path.DirectorySeparatorChar, '.') + ".";
49-
}
50-
}
51-
52-
/// <summary>
53-
/// Creates a <see cref="ResourceManagerStringLocalizer"/> using the <see cref="Assembly"/> and
54-
/// <see cref="Type.FullName"/> of the specified <see cref="Type"/>.
55-
/// </summary>
56-
/// <param name="resourceSource">The <see cref="Type"/>.</param>
57-
/// <returns>The <see cref="ResourceManagerStringLocalizer"/>.</returns>
58-
public IStringLocalizer Create(Type resourceSource)
59-
{
60-
if (resourceSource == null)
61-
{
62-
throw new ArgumentNullException(nameof(resourceSource));
63-
}
64-
65-
var typeInfo = resourceSource.GetTypeInfo();
66-
var assembly = typeInfo.Assembly;
67-
68-
// Re-root the base name if a resources path is set
69-
string baseName;
70-
if (assembly.FullName.StartsWith(_hostingEnvironment.ApplicationName))
71-
{
72-
baseName = string.IsNullOrEmpty(_resourcesRelativePath)
73-
? typeInfo.FullName
74-
: _hostingEnvironment.ApplicationName + "." + _resourcesRelativePath
75-
+ TrimPrefix(typeInfo.FullName, _hostingEnvironment.ApplicationName + ".");
76-
}
77-
else
78-
{
79-
var libName = TrimOnFirstComma(assembly.FullName);
80-
baseName = libName + "." + TrimPrefix(typeInfo.FullName, libName + ".");
81-
}
82-
83-
return _localizerCache.GetOrAdd(baseName, _ =>
84-
new ResourceManagerStringLocalizer(
85-
new ResourceManager(baseName, assembly),
86-
assembly,
87-
baseName,
88-
_resourceNamesCache)
89-
);
90-
91-
92-
}
93-
94-
/// <summary>
95-
/// Creates a <see cref="ResourceManagerStringLocalizer"/>.
96-
/// </summary>
97-
/// <param name="baseName">The base name of the resource to load strings from.</param>
98-
/// <param name="location">The location to load resources from.</param>
99-
/// <returns>The <see cref="ResourceManagerStringLocalizer"/>.</returns>
100-
public IStringLocalizer Create(string baseName, string location)
101-
{
102-
if (baseName == null)
103-
{
104-
throw new ArgumentNullException(nameof(baseName));
105-
}
106-
107-
location = location ?? _hostingEnvironment.ApplicationName;
108-
109-
if (location.StartsWith(_hostingEnvironment.ApplicationName))
110-
{
111-
baseName = location + "." + _resourcesRelativePath + TrimPrefix(baseName, location + ".");
112-
}
113-
else
114-
{
115-
baseName = location + "." + TrimPrefix(baseName, location + ".");
116-
}
117-
118-
return _localizerCache.GetOrAdd($"B={baseName},L={location}", _ =>
119-
{
120-
var assembly = Assembly.Load(new AssemblyName(location));
121-
return new ResourceManagerStringLocalizer(
122-
new ResourceManager(baseName, assembly),
123-
assembly,
124-
baseName,
125-
_resourceNamesCache);
126-
});
127-
}
128-
129-
private static string TrimPrefix(string name, string prefix)
130-
{
131-
if (name.StartsWith(prefix, StringComparison.Ordinal))
132-
{
133-
return name.Substring(prefix.Length);
134-
}
135-
136-
return name;
137-
}
138-
139-
private static string TrimOnFirstComma(string name)
140-
{
141-
142-
return name.Substring(0, name.IndexOf(","));
143-
144-
}
145-
}
146-
}
1+
//using System;
2+
//using System.Collections.Concurrent;
3+
//using System.IO;
4+
//using System.Reflection;
5+
//using System.Resources;
6+
//using Microsoft.AspNetCore.Hosting;
7+
//using Microsoft.Extensions.Options;
8+
9+
////https://github.com/aspnet/Localization/issues/139
10+
11+
//namespace Microsoft.Extensions.Localization
12+
//{
13+
// /// <summary>
14+
// /// An <see cref="IStringLocalizerFactory"/> that creates instances of <see cref="ResourceManagerStringLocalizer"/>.
15+
// /// </summary>
16+
// public class PatchedResourceManagerStringLocalizerFactory : IStringLocalizerFactory
17+
// {
18+
// private readonly IResourceNamesCache _resourceNamesCache = new ResourceNamesCache();
19+
// private readonly ConcurrentDictionary<string, ResourceManagerStringLocalizer> _localizerCache =
20+
// new ConcurrentDictionary<string, ResourceManagerStringLocalizer>();
21+
// private readonly IHostingEnvironment _hostingEnvironment;
22+
// private readonly string _resourcesRelativePath;
23+
24+
// /// <summary>
25+
// /// Creates a new <see cref="ResourceManagerStringLocalizer"/>.
26+
// /// </summary>
27+
// /// <param name="hostingEnvironment">The <see cref="IHostingEnvironment"/>.</param>
28+
// /// <param name="localizationOptions">The <see cref="IOptions{LocalizationOptions}"/>.</param>
29+
// public PatchedResourceManagerStringLocalizerFactory(
30+
// IHostingEnvironment hostingEnvironment,
31+
// IOptions<LocalizationOptions> localizationOptions)
32+
// {
33+
// if (hostingEnvironment == null)
34+
// {
35+
// throw new ArgumentNullException(nameof(hostingEnvironment));
36+
// }
37+
38+
// if (localizationOptions == null)
39+
// {
40+
// throw new ArgumentNullException(nameof(localizationOptions));
41+
// }
42+
43+
// _hostingEnvironment = hostingEnvironment;
44+
// _resourcesRelativePath = localizationOptions.Value.ResourcesPath ?? string.Empty;
45+
// if (!string.IsNullOrEmpty(_resourcesRelativePath))
46+
// {
47+
// _resourcesRelativePath = _resourcesRelativePath.Replace(Path.AltDirectorySeparatorChar, '.')
48+
// .Replace(Path.DirectorySeparatorChar, '.') + ".";
49+
// }
50+
// }
51+
52+
// /// <summary>
53+
// /// Creates a <see cref="ResourceManagerStringLocalizer"/> using the <see cref="Assembly"/> and
54+
// /// <see cref="Type.FullName"/> of the specified <see cref="Type"/>.
55+
// /// </summary>
56+
// /// <param name="resourceSource">The <see cref="Type"/>.</param>
57+
// /// <returns>The <see cref="ResourceManagerStringLocalizer"/>.</returns>
58+
// public IStringLocalizer Create(Type resourceSource)
59+
// {
60+
// if (resourceSource == null)
61+
// {
62+
// throw new ArgumentNullException(nameof(resourceSource));
63+
// }
64+
65+
// var typeInfo = resourceSource.GetTypeInfo();
66+
// var assembly = typeInfo.Assembly;
67+
68+
// // Re-root the base name if a resources path is set
69+
// string baseName;
70+
// if (assembly.FullName.StartsWith(_hostingEnvironment.ApplicationName))
71+
// {
72+
// baseName = string.IsNullOrEmpty(_resourcesRelativePath)
73+
// ? typeInfo.FullName
74+
// : _hostingEnvironment.ApplicationName + "." + _resourcesRelativePath
75+
// + TrimPrefix(typeInfo.FullName, _hostingEnvironment.ApplicationName + ".");
76+
// }
77+
// else
78+
// {
79+
// var libName = TrimOnFirstComma(assembly.FullName);
80+
// baseName = libName + "." + TrimPrefix(typeInfo.FullName, libName + ".");
81+
// }
82+
83+
// return _localizerCache.GetOrAdd(baseName, _ =>
84+
// new ResourceManagerStringLocalizer(
85+
// new ResourceManager(baseName, assembly),
86+
// assembly,
87+
// baseName,
88+
// _resourceNamesCache)
89+
// );
90+
91+
92+
// }
93+
94+
// /// <summary>
95+
// /// Creates a <see cref="ResourceManagerStringLocalizer"/>.
96+
// /// </summary>
97+
// /// <param name="baseName">The base name of the resource to load strings from.</param>
98+
// /// <param name="location">The location to load resources from.</param>
99+
// /// <returns>The <see cref="ResourceManagerStringLocalizer"/>.</returns>
100+
// public IStringLocalizer Create(string baseName, string location)
101+
// {
102+
// if (baseName == null)
103+
// {
104+
// throw new ArgumentNullException(nameof(baseName));
105+
// }
106+
107+
// location = location ?? _hostingEnvironment.ApplicationName;
108+
109+
// if (location.StartsWith(_hostingEnvironment.ApplicationName))
110+
// {
111+
// baseName = location + "." + _resourcesRelativePath + TrimPrefix(baseName, location + ".");
112+
// }
113+
// else
114+
// {
115+
// baseName = location + "." + TrimPrefix(baseName, location + ".");
116+
// }
117+
118+
// return _localizerCache.GetOrAdd($"B={baseName},L={location}", _ =>
119+
// {
120+
// var assembly = Assembly.Load(new AssemblyName(location));
121+
// return new ResourceManagerStringLocalizer(
122+
// new ResourceManager(baseName, assembly),
123+
// assembly,
124+
// baseName,
125+
// _resourceNamesCache);
126+
// });
127+
// }
128+
129+
// private static string TrimPrefix(string name, string prefix)
130+
// {
131+
// if (name.StartsWith(prefix, StringComparison.Ordinal))
132+
// {
133+
// return name.Substring(prefix.Length);
134+
// }
135+
136+
// return name;
137+
// }
138+
139+
// private static string TrimOnFirstComma(string name)
140+
// {
141+
142+
// return name.Substring(0, name.IndexOf(","));
143+
144+
// }
145+
// }
146+
//}

src/cloudscribe.Web.Localization/cloudscribe.Web.Localization.csproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
<PropertyGroup>
44
<Description>more flexible localization for ASP.NET Core</Description>
5-
<VersionPrefix>1.2.1</VersionPrefix>
5+
<VersionPrefix>2.0.0</VersionPrefix>
6+
<VersionSuffix>preview20170725</VersionSuffix>
67
<Authors>Joe Audette</Authors>
7-
<TargetFrameworks>netstandard1.6</TargetFrameworks>
8+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
89
<AssemblyName>cloudscribe.Web.Localization</AssemblyName>
910
<PackageId>cloudscribe.Web.Localization</PackageId>
1011
<PackageTags>cloudscribe;localization;resx</PackageTags>
@@ -17,8 +18,9 @@
1718
</PropertyGroup>
1819

1920
<ItemGroup>
20-
<PackageReference Include="Microsoft.Extensions.Localization" Version="1.1.*" />
21-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.*" />
21+
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0-*" />
22+
<PackageReference Include="Microsoft.Extensions.Localization" Version="2.0.0-*" />
23+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0-*" />
2224
</ItemGroup>
2325

2426

src/localization.WebApp/Startup.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ public Startup(IHostingEnvironment env)
2828
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
2929
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
3030

31-
if (env.IsDevelopment())
32-
{
33-
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
34-
builder.AddUserSecrets();
35-
}
31+
3632

3733
builder.AddEnvironmentVariables();
3834
Configuration = builder.Build();
@@ -108,7 +104,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
108104
{
109105
app.UseDeveloperExceptionPage();
110106
app.UseDatabaseErrorPage();
111-
app.UseBrowserLink();
107+
//app.UseBrowserLink();
112108
}
113109
else
114110
{

0 commit comments

Comments
 (0)