harry
harry

Reputation: 89

How to make a project internationalized in Struts 2?

I want to make my project internationalized. I am giving support for the Spanish and Italian languages, but some of the characters from both of the languages (acute accent and grave accent characters) are not appearing properly on the UI.

Does anybody have the solution for this problem?

Upvotes: 0

Views: 231

Answers (2)

Roman C
Roman C

Reputation: 1

The framework is internationalized.

You need to add the corresponding to each locale resource bundles for the localized messages that you display via the struts tags. Use text tag or getText() to retrieve a message in the UI.

The browser language is passed with the HTTP request and framework create a locale corresponding to the browser settings. Switching locale performed via passing a special parameter request_locale to i18n interceptor that should be on your stack.

You can also configure this interceptor to accept user-defined parameters.

Normally switching to a locale persist for the session of the user. So, you don't have to pass a parameter each time on every request, but this case is also supported if needed. See how could you achieve all of the above using localization.

Upvotes: 0

peterh
peterh

Reputation: 1

Yes. You have an encoding problem. Your server gives the pages in a different encoding, as your browser thinks, and this is because international characters appear faulty.

You need to fix the settings of your webapp and your appserver, to use the better encoding (preferable utf-8).

Upvotes: 1

Related Questions