0

I am implementing Struts2 i18n with English and French languages. I want to toggle these options. If URL parameter contains ?request_locale=en_US, then I want to show French language option else English language option. Here is some implementations that I have tried out, but somehow it didn't work.

``<s:if test="#params.request_locale == 'en_US'">
                            <s:url var="localeFR" action="locale" includeParams="get">
                                <s:param name="request_locale">fr_FR</s:param>
                            </s:url>
                            <s:a id="fr" href="%{localeFR}"> FR <i class="fa fa-globe"></i>
                            </s:a>
                        </s:if>
                        <s:else>
                            <s:url var="localeEN" action="locale" includeParams="get">
                                <s:param name="request_locale">en_US</s:param>
                            </s:url>
                            <s:a id="en" href="%{localeEN}" onclick="changelocale()"> EN <i
                                    class="fa fa-globe"></i>
                            </s:a>
                        </s:else>
codej
  • 1
  • 2

0 Answers0