This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Node.js | |
trigger: | |
- master | |
pool: | |
vmImage: 'ubuntu-latest' | |
steps: | |
- task: NodeTool@0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal static class ResourceGroupExtensions | |
{ | |
/// <summary> | |
/// Converts the source data to a Javascript variable | |
/// </summary> | |
/// <param name="resources">The record to convert</param> | |
/// <returns>A valid Javascript object</returns> | |
internal static string ToJavascript(this IEnumerable<ResourceGroup> resources) | |
{ | |
StringBuilder sb = new StringBuilder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Razor.TagHelpers; | |
using Microsoft.Extensions.Localization; | |
using System.Linq; | |
using System.Reflection; | |
namespace InjectJavascriptToWebApp | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<environment include="Development"> | |
<resources names='new[] { "Labels" }'></resources> | |
<script src="~/lib/jquery/dist/jquery.js"></script> | |
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script> | |
</environment> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ResourcesHelper | |
{ | |
private readonly IStringLocalizerFactory _stringLocalizerFactory; | |
public ResourcesHelper(IStringLocalizerFactory stringLocalizerFactory) | |
{ | |
_stringLocalizerFactory = stringLocalizerFactory; | |
} | |
public IEnumerable<LocalizedString> GetResources(string name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class ResourceGroup | |
{ | |
public string Name { get; set; } | |
public IEnumerable<LocalizedString> Entries { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddLocalization(options => options.ResourcesPath = "Resources"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.Configure<CookiePolicyOptions>(options => | |
{ | |
// This lambda determines whether user consent for non-essential cookies is needed for a given request. | |
options.CheckConsentNeeded = context => true; | |
options.MinimumSameSitePolicy = SameSiteMode.None; | |
}); | |
services.AddLocalization(options => options.ResourcesPath = "Resources"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
else | |
{ | |
app.UseExceptionHandler("/Error"); | |
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class ResourceJavaScriptService | |
{ | |
/// <summary> | |
/// Converts the source data to a Javascript variable | |
/// </summary> | |
/// <param name="fields">The record to convert</param> | |
/// <returns>A valid Javascript object</returns> | |
public string ToJavascript(IEnumerable<ResourceGroup> fields) | |
{ | |
StringBuilder sb = new StringBuilder(); |