I fear you’d have to create a minimal repro on GitHub or somewhere so I can take a look at. I’ve just created a fresh new project and it worked as described so I guess there is just one more little gotcha hidden somewhere.
From looking at your application I can’t really figure out what went wrong, since if you inspect my sample I had the translations done as you have. What is different though is how you host those files. In the CLI example of mine I’ve just pulled out the locales folder into root and accessing them from there. But in your C# project that might be different. I saw the copy task in your aurelia.json configuration so perhaps your backend isn’t serving the files properly.
Since you have debug: true do you see any weird outputs in your console?
EDIT: can’t run your sample since I’m on Mac or alternatively Linux at home
@zewa666 Thanks so much for taking the time to look at this for me. I’ve compared line by line your app with mine. I went through build.ts, transpile.ts, aurelia.json and changed the tiny differences so that both projects are truly identical.
I can see that the translation files are copied correctly to wwwroot/locales.
I think I’ve discovered the problem - just need to find out how to resolve it.
I’m 99% sure that the C# server is not serving up yml files
This saga should probably be added to the documentation somewhere.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
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.
app.UseHsts();
}
Globalization.Configure(app);
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".yml"] = "text/plain";
// this is the bit that adds the yml files
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(),"wwwroot","locales")),
RequestPath = "/locales",
ContentTypeProvider = provider
});
app.UseFileServer(new FileServerOptions {EnableDefaultFiles = true, EnableDirectoryBrowsing = false});
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseHttpsRedirection();
SwaggerInitialize.Configure(app);
app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute().RequireAuthorization());
Log.Logger.Information("Successfully ran Startup.Configure()");
}
Again - thanks so much for everyone’s help - I would never have got here on my own!
I use Google Translate for translating French and Portuguese. It does a pretty good job, and I’m fluent enough in both languages to spot any silly errors.
However, I also need to translate into Vietnamese. My friends in Vietnam tell me that Google is atrocious in doing the translation.
Does anyone have any experience of translating into Vietnamese, or could suggest a cheap (preferably free) service that can do the translations?
Mind you, now that I’ve moved over to yaml , the files are much easier to hand over to a non-programmer and ask him to do the translation.
First of all, glad that you got it working. Was a hard ride but you’ve eventually made it. Congratz
Looking at your FileExtTypeProvider, I’d suggest to switch the mime type to the correct one for yml application/x-yaml, which resembles application/json quite well.
I’m defintely new to yaml myself so good to know that >- is possible as well.
Talking about translations, the guys behind i18next have a service called Locize. On their services page they’re listing a few partners which might be a good start for your search.
I do have experience of translating into Vietnamese but you don’t want to hire me (it’s not cheap).
Unfortunately there are no reliable automated solutions for English - Vietnamese translation yet; I have tried Amazon, Microsoft, Google, Babel, etc.
Your best bet would be a professional translation service, such as https://translated.com/