GithubHelp home page GithubHelp logo

Comments (6)

faresayyad avatar faresayyad commented on June 16, 2024 1

Thank you very much, yes this issue was solved
and sorry for late response

from expresslocalization.

LazZiya avatar LazZiya commented on June 16, 2024

Hi @faresayyad ,

Can you please provide more details:

  • Version of ExpressLocalization
  • Registered routes
  • How do you change the culture? are you using LanguageNavTagHelper
  • Can you explain how do you use the code in _Layout?
routeData["culture"] = "{0}"; //how do you use this?

from expresslocalization.

faresayyad avatar faresayyad commented on June 16, 2024

@LazZiya
Thank you for quick response,
Yes, sure:
the app is developed on top of .net core 3.1
1- version is: LazZiya.ExpressLocalization 4.0.0
2- in startup.cs I use endpoints to configure routes:




 app.UseEndpoints(endpoints =>
            {
                endpoints.MapAreaControllerRoute(
                               name: "Admin",
                               "Areas",
                               pattern: "{culture=en}/{area:exists}/{controller=GlobalSettings}/{action}/{id?}");

                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{culture=en}/{controller=Home}/{action=Index}/{id?}");

                endpoints.MapControllers();
                endpoints.MapRazorPages();
            });

** one for areas and the other for default

3- Yes I change the culture using LanguageNavTagHelper, as you mentioned here:
https://github.com/LazZiya/TagHelpers/wiki/LanguageNav-TagHelper-Setup#redirect-to-url

@{ 
    var routeData = ViewContext.RouteData.Values;
    routeData["culture"] = "{0}";
}
<language-nav redirect-to-url="@(Url.RouteUrl(routeData))"></language-nav>

2020-05-14_13-14-52

These are the helpers passed to anchor tag:
Update

from expresslocalization.

LazZiya avatar LazZiya commented on June 16, 2024

@faresayyad Looks like you need the routing attributes on the controller:

[Area("Admin")]
[Route("{culture=en}/Admin/[controller]/[action]")]
public class GlobalSettingsController : Controller
{
    // ...
}

Additional notices:

  • Instead of this:
<a href="..."><localize>Update</localize></a>

You can do this:

<a href="..." localize-content>Update</a>
  • Make sure that routeData is defined directly above the <language-nav> tag, otherwise VS will fail to compile the project but will not show an error in the Error List!

from expresslocalization.

LazZiya avatar LazZiya commented on June 16, 2024

@faresayyad I hope that the previous reply has answered your question and solved your problem.

I will close this issue, and feel free to reopen if you need any further help,

Regards,
Ziya

from expresslocalization.

faresayyad avatar faresayyad commented on June 16, 2024

Hello,

I would like to reopen the question, please.
One of the cases I faced regarding parameters is like this:


   [Route("{culture}/Properties/Details/{propRefNo?}")]
        public async Task<IActionResult> PropertyDetails(string propRefNo)

as you can see the parameter is of type string. whenever I try to change the language the parameters are gone.
Please refer to the below image marked with red.
image
@LazZiya

from expresslocalization.

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.