Hi
I have a small doubt regarding the usage of ‘squidex/backend/i18n ’ project. I haven’t found any reference of this project in ‘squidex/backend/src’. Can you help me with its reference and usage?
Thanks.
This are just the source files:
Backend
The generator in the project creates the resx files:
Fontend
Development Time
The resources are loaded directly from this folder:
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false,
textLogger: true,
textResolver: () => {
const culture = window['options']?.more?.culture || 'en';
return require(`./../../../backend/i18n/frontend_${culture}.json`);
},
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
This file has been truncated. show original
Production
The translations is injected into the HTML and loaded as global variable:
export const environment = {
production: true,
textLogger: false,
textResolver: () => {
return window['texts'];
},
};
}
scripts.Add($"var options = {JsonSerializer.Serialize(clonedOptions)};");
}
html = html.Replace(Placeholder, string.Join(Environment.NewLine, scripts), StringComparison.OrdinalIgnoreCase);
return html;
}
private static string GetText(string culture)
{
if (!Texts.TryGetValue(culture, out var result))
{
var assembly = typeof(IndexExtensions).Assembly;
var resourceName = $"Squidex.Areas.Frontend.Resources.frontend_{culture}.json";
var resourceStream = assembly.GetManifestResourceStream(resourceName);
if (resourceStream != null)
{
1 Like
Thanks for the explanation.
1 Like