Comments (6)
Thank you very much, yes this issue was solved
and sorry for late response
from expresslocalization.
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.
@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>
These are the helpers passed to anchor tag:
Update
from expresslocalization.
@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.
@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.
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.
@LazZiya
from expresslocalization.
Related Issues (20)
- Roadmap HOT 2
- DefaultRequestCulture not working when change to non-en culture in 3.1.3 HOT 3
- Can we create custom DataAnnotations to avoid re-typing ErrorMessage in every attribute HOT 1
- Case sensitivity mismatch HOT 2
- Null pointer exception HOT 5
- Language Selection Dropdown not Working HOT 4
- NullReferenceException when RazorPages is not enabled for MVC project with .NET CORE 3.1 HOT 3
- Missing ExRequiredAttributeAdapter HOT 3
- RoutePatternException HOT 8
- DataAnnotation messages not being translated HOT 2
- Retrieve Value from .resx file HOT 6
- Problem with ExpressValidationAttributeAdapterProvider HOT 7
- ExRange unexpected behavior as Required HOT 3
- ExpressLocalizationCore3 Field Validation Issue HOT 2
- Culture is not supported HOT 9
- Null Reference Error HOT 4
- Urls without language tag does not work. HOT 2
- Localization with query string HOT 3
- Breaking change in MS.NET.Test.Sdk HOT 5
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 expresslocalization.