Comments (10)
Created under: #80
Do note that once the page loads, you need to refresh once for the wasm to kick in and then you get the error
from my.extensions.localization.json.
Hey @hishamco I worked out the logic by debugging with the library and I was able to get it working by using embedded resources and allowing it to load that embedded resource if the file does not exist (both needed for Server/Wasm).
I hope this helps find a proper solution, the commit is in #80
from my.extensions.localization.json.
Hi @eliyammine could you please let me the steps to reproduce?
from my.extensions.localization.json.
Can you reproduce it on the repo sample?
from my.extensions.localization.json.
https://github.com/eliyammine/LocalizationDotNet8/commits/master/
I started with the template by Microsoft and my last commit is all the changes I did to reproduce.
You can see when you run it that it never switches to WASM because it crashes trying to find the path.
from my.extensions.localization.json.
The issue seems to be stemming from Assembly.GetExecutingAssembly().Location being null for PathHelpers.GetApplicationRoot()
Could some sort of workaround being that it can accept a URL where it downloads it from?
I've tried the following, downloading the file before initializing it but having no luck with that either (it does download the file but the issue above still occurs):
builder.Services.AddJsonLocalization(async options =>
{
using (ServiceProvider serviceProvider = builder.Services.BuildServiceProvider())
{
var httpClient = serviceProvider.GetRequiredService<HttpClient>();
var response = await httpClient.GetAsync("Resources/fr-FR.json");
Directory.CreateDirectory("Resources");
if (response.IsSuccessStatusCode)
{
string json = await response.Content.ReadAsStringAsync();
File.WriteAllText("Resources/fr-FR.json", json);
}
}
options.ResourcesPath = "Resources";
})
from my.extensions.localization.json.
Could you please help to reproduce the issue by modifying the repo sample, so I can debug easily? Feel free to create a PR or fork the repo then create a branch with the required changes
from my.extensions.localization.json.
Would you like me to create a new sample? The one difference that would be hard to test in any of the samples would be the AutoInteractivity mode since both Blazor projects are standalone and not connected as a Hosted Blazor WebAssembly App
from my.extensions.localization.json.
I need a sample that uses the library then I can add it to the code base locally after that I can test the issue
from my.extensions.localization.json.
I can reproduce the issue, working on it ...
from my.extensions.localization.json.
Related Issues (20)
- Registering the service one should provide absolute path, otherwise exception is thrown HOT 31
- Localization FallBack Considerations
- Support ResourceLocationAttribute HOT 1
- Support RootNamespaceAttribute
- assign culture in runtime HOT 3
- Have one resource file for project HOT 13
- Any plan to switch the project to a .NET standard class library ? HOT 10
- How to use with DataAnnotation? HOT 17
- Regression Bug HOT 1
- LocalizationSample project is not working HOT 3
- About NET5.0 Blazor WebAssembly Uses My.Extensions.Localization.Json HOT 14
- System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. HOT 11
- Class based localisation only works when the class is in the root namespace HOT 5
- Can you provide an core api example with DataAnnotations? HOT 2
- when using xunit test(SUT),there is an exception throwed! HOT 7
- JsonResourceManager does not dispose of (unix) File System Watches HOT 2
- Support for hierarchical keys? HOT 5
- how can refresh cache? HOT 6
- Fallback to the default culture resource HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from my.extensions.localization.json.