We are currently working on the forum. For the short-term, all forum content will be in read-only format. We apologize for the interruption and look forward to collaborating with you shortly. All the best in your research!

i18n Resource contents does not change dynamically according to browser's language preferences

I installed Japanese translations on OpenClinica 3.4.

Under that environment, some of the internationalized resources are always used even when I changed my browser's preferences to "English".
In details, almost all messages will change according to browser's preferences. For example, messages on pages/studymodule changes in perfect way.
But some of strings does not change. For example, on UpdateStudyNew page (editing study description and status), selection options of Study Phase, Purpose, Selection, and Timing fields are always displayed in Japanese, even when browser's preferences is English.

I viewed some of source codes, then wondering some handling of "resadmin" resource bundle might have some bugs. 
Does anyone have same problem and possible solutions?



  • mokadamokada Posts: 10
    I attached example from UpdateStudyNew page.
    Contents of select box are displayed in Japanese, even though browser's preference language is English.
    in updateStudy4.jsp, JSP code is below. ${resadmin} should be initialized according to browser's preferences, but it seems not.

       <c:forEach var="purpose" items="${obserPurposeMap}">
       <c:set var="purposekey">
       <fmt:message key="${purpose.key}" bundle="${resadmin}"/>

            <c:when test="${purpose1 == purposekey}">
             <option value="<c:out value="${purpose.key}"/>" selected><c:out value="${purpose.value}"/>
             <option value="<c:out value="${purpose.key}"/>"><c:out value="${purpose.value}"/>

  • hhonshukuhhonshuku Posts: 50
    Hi Mokada-san,

    I am not having this problem.  As a habit, I set FireFox cashing to 0MB.  What happen if you manually clear the browser cache?

    I think OpenClinica doesn't expect user to switch local often.  Nevertheless, if you have a solution, your source code contribution would be appreciated.

    Best regards.
  • mokadamokada Posts: 10
    via Email
    こんばんは、hhonshuku さん

    (I assume you can read Japanese, if not, please notify me)


    他のリソースはきちんと動的に変化するんですが、admin.properties のリソースのみおかしな感じがするので、もう少しソースを追ってみようかと思います。あと、Observational Studyの場合のPurposeの一覧とか、ほとんどClinicalTrials.gov準拠になっていない状況のところもあるので、そのあたりも修正したいなぁと思っています。とりあえずEclipse+m2e+EGitの環境でソースをいじれるところまでは準備したので、パッチを作ってpull request を発行していくつもりです。

    Masafumi OKADA 岡田 昌史 M.D., Ph.D.
    筑波大学人間総合科学研究科 疫学教室
    University of Tsukuba, Dept. of Epidemiology
    E-Mail: [email protected]

    On 2014年10月20日 at 23:19:30, hhonshuku ([email protected]) wrote:

    Hi Mokada-san,

    I am not having this problem.  As a habit, I set FireFox cashing to 0MB.  What happen if you manually clear the browser cache?

    I think OpenClinica doesn't expect user to switch local often.  Nevertheless, if you have a solution, your source code contribution would be appreciated.

    Best regards.
  • hhonshukuhhonshuku Posts: 50
    Thank you for your update.  Yes, I can read/write Japanese, while it will be more beneficial to others in English.  If you'd like, I welcome personal messages in Japanese.

    I have not been able to reproduce your issue on my end.  I am on Mac OSX10.9.5 and FireFox v30.  Please let me know your environment so I can try to reproduce it.

    Best regards.

  • mokadamokada Posts: 10
    I'm sorry that I misunderstood that my previous message was personal message. 
    I will continue conversation with English.

    My environment is Ubuntu 12.04.5 LTS running Tomcat 6.0.35. 
    System locale is ja_JP.UTF-8.
    Maybe older tomcat version cause the problem. I will try to reproduce the problem within Ubuntu 14 virtual machine.

  • hhonshukuhhonshuku Posts: 50
    Dear Okada-san,

    I was able to reproduce the issue.  Thank you for reporting.
  • mokadamokada Posts: 10

    I found there are two problems around internationalized resources.

    First, depending on operating system's locale and java implementation, original English resource files cannot be read by openclinica instance. To avoid this issue, renaming original resource files are required.

    Second, when updating browser's language preferences dynamically, JSP components follows locale changes, but Servlet components will not follow changes. To fix this issue, a patch on source code will be required ( I'm testing that now ).

    Details of the first problem:

    When openclinica runs in Ubuntu 12.0.4 , running OpenJDK  6b33-1.13.5-1ubuntu0.12.04, in ja_JP.UTF-8 locale, getBundle(name,locale) method of java.util.ResouceBundle class seeks resources for given locale. But if resource file for specified locale cannot be found, it obtains resource file for "default locale". 
    In Japanese OS locale, the "default locale" is Japanese. So once I copied Openclinica's Japanese localized resource files (i.e. admin_ja.properties, words_ja.properties....) on WEB-INF/classes/org/akaza/openclinica/i18n/, only Japanese resource files are read. Original resource files are ignored because it (admin.properties, words.properties...) has no locale suffix in its filename.

    To avoid this, I renamed original resource files to have "_en" suffix.(i.e. admin_en.properties, words_en.properties...) 
    This fixed my problem partially. Within one tomcat session, English study purposes or selections are correctly displayed. 

    But still study purposes or selections does not follow browser's language preferences.
    I think that is because lack of codes which updates resource contents in servlet components. I am trying a patch for UpdateStudyNew.java and CreateStudyServlet.java. When I will succeed to solve the problem I'll post follow-up.

  • mokadamokada Posts: 10
    Here is a patch to update servlets' internationalized resources, every time when servlet is called.

    Current OpenClinica 3.4 sourcetree does not update key-value map, which is used to make selection boxes in UpdateStudyNew servlet. Updating function is found in CreateStudyServlet.java, but it was non-static private function. So this patch makes almost same function as public static function, and call it from UpdateStudy and UpdateStudyNew servlet class.

    With this patch, every time when I changed browser's language preferences and reload openclinica pages, language changes dynamically, including choices in select boxes.

  • rpetrusevschirpetrusevschi Posts: 24 admin
    Hi Okada-san,

    Thank you for your patch. We'll have our team look at it. We will soon have our i18n/L10n files available on GitHub to make such submissions easier. 

    All the best,
  • hhonshukuhhonshuku Posts: 50
    Thank you for your pull request.  I pushed it to our product manager.  Stay tuned!
This discussion has been closed.