am using struts2, i need to do multi language option, language option i have put in header of the all pages.May i know, to pass action name at dynamically it is possible in struts.xml file.action name is dynamic or static? can anybody help me please, advance in thanks.
for example:In the struts.xml file
$(curActionName)
firstly action can be selected dynamically by using the wild card method. this tutorial will help you understand wild card mappings.
http://struts.apache.org/2.0.6/docs/wildcard-mappings.html
However since you are talking about many language support if all you want is rendering same page in different languages you will not need dynamic action as struts already has an elegant internationalization feature where you just have to maintain properties file for each language. this makes it easier to maintain your website.you can study more of this here.
http://struts.apache.org/2.0.14/docs/localization.html
Related
Im looking to make the editor templates in my MVC application use HTML5 input types. The framework seems to get about 80% of the way there but there are a couple of things I can't seem to make happen (step values on numerics, placeholders, URL inputs, etc).
I'm sure that quite a bit of this is just me not knowing where to look, but
Is there a definitive list of what attributes I can use on View Models to provide the metadata used to generate the html?
Does anyone know of a project / nuget package that helps with this? I'm not opposed to writing something, but would rather use something that's already been tried and tested. Dean Hume's ASP.net MVC HTML5 Helpers Toolkit is close, but I'd like to put as much information in the attributes as possible and let the runtime do the work via Html.EditorFor (just a personal preference).
Thanks,
Joe
Check this out : http://weblogs.asp.net/rashid/archive/2010/10/21/integrate-html5-form-in-asp-net-mvc.aspx
See if it can help you get started.
I am currently working with localizing my MVC4 web application and have run in to an issue. My site is in four languages, English, French, Russian and Polish. I set up the sites culture based upon what the user selects. This is not tracked in the url.
I want my urls to be SEO friendly. So I need them to be localized. The tricky part though is that fact I routes set up for my controllers in English. For example
/product/product-name is mapped to the product controller and the get action
/customer/details is mapped to the customer controller and the details action
How can I localize the routes to different languages/cultures? So when I create an action link it maps to correct controller/action, generating the localized url?
I found this solution and it is very elegant but the issue I have is that it does not work as well for dynamic url's, as there is a need for explicit mapping.
Actually I don't know the right answer for that question and it's really very interesting how it possible to do that with standard MVC routing.
But if you do not find proper way to implement that with standard options you could implementing that by hands with the helps of front controler.
You create the class which will be main point of availability inside your app. And inside that method you could implement redirecting logic which will redirect you to the proper controller/action.
Learning asp.net mvc and I am building a small website that will be initially in 2 languages.
10 or more pages are static pages with bold bits etc...
What is the best approach for localising these pages?
Is there a way to do it without creating a page for language that would be a no in my book.
How do you handle localisation of static pages in asp.net mvc? In asp.net there was some sort of localise control.
Any suggestions?
The way to do this is using resource files. You create an resource file for your default language and then one for each other language your site should run in.
This article describes how to do it. For example if you want english (default) and french you could create two resource files (.resx files) Website.resx and Website.fr-FR.resx. The first file for your default language, which is english and the second file for french. Both files exists from a key-value pair.
EDIT: Another interresting article describing the same idea can be found here.
I think that the best approach is still creating two files for them,
cause they are not static pages forever, they may change in future,
Or you can generalize the solution and save the text in database
for those two languages and render the correct content base on the selected culture.
They can be saved in the sense that they are pages on newsroom,
whenever you add a news you enter the text for both cultures.
I would like to create little higer-level framework on top of Struts2 which can take form element description from Action and render a complete form, in order to avoid having a separate JSP files with hardcoded form elements for every form in a large web application (so if I manage to do this I will have just a few generic JSPs for data form and few for layout). Application is extremely data-driven.
My idea is to create form description using custom objects in the Action (i.e. Button, TextInput etc.) and then to create a single JSP page that will render eveything out.
What is the best way of doing this? Can you propose some concrete way to do this?
I don't want to write something if I can reuse the existing code with some effort.
Any ideas are appreciated.
Kind regards,
Bozo
It seems to me you are trying to build a web framework on top of another, I doubt Struts2 is appropiate for that.
If you have a data-driven web app for which you dont want to write many similar JSP (or whatever view lang) pages, perhaps you'd better look at some frameworks with scaffolding abilities , eg Grails http://www.grails.org/Scaffolding
I did what I asked in the question myself - I have created a few generic JSP templates (list, edit etc.) which take application parameters and create output grids and forms using the struts2 and simple HTML tags. Using this method generic tiles definitions can also be created and used. So at the end using simple definition in the struts2 action, the grid and form is generated.
How can create multilingual Django site?
Is it a good idea to create template set for each language?
How should I use that sets of templates (if it's a good idea)?
Take a look at this question: How to localize Content of a Django application
I'd say try to maintain the same template for each language. However, if you must, or if you feel it is reasonable, you can certainly use a set of different templates for certain other languages. For instance, I know that Arabic is read from right to left, so perhaps a different template is worthwhile in that case.