GithubHelp home page GithubHelp logo

Comments (10)

LunaWanderer1 avatar LunaWanderer1 commented on June 21, 2024 1

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.

LunaWanderer1 avatar LunaWanderer1 commented on June 21, 2024 1

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.

hishamco avatar hishamco commented on June 21, 2024

Hi @eliyammine could you please let me the steps to reproduce?

from my.extensions.localization.json.

hishamco avatar hishamco commented on June 21, 2024

Can you reproduce it on the repo sample?

from my.extensions.localization.json.

LunaWanderer1 avatar LunaWanderer1 commented on June 21, 2024

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.

LunaWanderer1 avatar LunaWanderer1 commented on June 21, 2024

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.

hishamco avatar hishamco commented on June 21, 2024

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.

LunaWanderer1 avatar LunaWanderer1 commented on June 21, 2024

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.

hishamco avatar hishamco commented on June 21, 2024

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.

hishamco avatar hishamco commented on June 21, 2024

I can reproduce the issue, working on it ...

from my.extensions.localization.json.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.