cancel
Showing results for 
Search instead for 
Did you mean: 

how to change language of alfresco share

bsaric
Champ in-the-making
Champ in-the-making
OK, i have managed to ad another language besides english to alfresco explorer but I just cant seem to change the language of alfresco share.

My web-client-config-custom.xml file looks like this:

<!– Example of adding languages to the list in the login page –>
   <config evaluator="string-compare" condition="Languages" replace="true">
      <languages>
         <language locale="hr_HR">Croatian</language>
    <language locale="en_US">English</language>
      </languages>
   </config>

and I have put .properties files for the croatian language in C:\Alfresco\tomcat\shared\classes\alfresco\messages

Please help.
17 REPLIES 17

cristina_aragon
Champ on-the-rise
Champ on-the-rise
Hi all!

I´m also trying to put my Alfresco Share in spanish but don´t work any of the solutions I've read in this forum.
I have put the language packages:

For Share, unpack to: <TOMCAT_HOME>/webapps/share/modules/editors/tiny_mce
For Explorer, unpack to: <TOMCAT_HOME>/webapps/alfresco/scripts/tiny_mce

But it doesn´t work.

I have put the *.properties files from the Alfresco forge repository into:

…/tomcat/shared/classes/alfresco/messages/
…/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/messages

but nothing.
I have delete the temp and work directorys from tomcat, the cache from my navigator and nothing.
What else can I try?

Thanks in advance!
Cristina

dennobo
Champ in-the-making
Champ in-the-making
Hi!

I am also looking into how to change the language of /share.

I know that it is depending on the browser locale. But I don't want it to be.

We agreed to use english as the main language for our Alfresco, although most of us use a different locale for browsing.

So how and where do I restrict the language? I wasn't really able to find the right information.

Thanks!

pawel_rzeszowsk
Champ in-the-making
Champ in-the-making
Hi,
it is possible, I have done it the following way:
1. I have modiefied the file slingshot-login.ftl so the user can choose the language during the loggining:
               <select id="language" name="language" size="1" style="width:150px">
               <option value="en_US" selected="selected">English</option>
              <option value="de_DE">German</option>   
              <option value="es_ES">Spanish</option>
              <option value="fr_FR">French</option>
              <option value="it_IT">Italian</option>
              <option value="ja_JP">Japanese</option>
              <option value="pl_PL">Polish</option>
            </select>
            </div>
2. I have created the jar, and put it on the Share classpath with the following code:


      Locale locale = null;
      Cookie[] cookies = request.getCookies();
      String acceptLang = null;
      // finding ALFRESCO_UI_PREFLANG
      if(cookies != null) {
         for (int i = 0; i < cookies.length; i++) {
            if (cookies[i].getName().equals("ALFRESCO_UI_PREFLANG")) {
               acceptLang = cookies[i].getValue();
               break;
            }
         }
      }
      // if cookie not found, use "Accept-Language"
      // set language locale from browser header
      if (acceptLang == null) {
         acceptLang = request.getHeader("Accept-Language");
      }
      
      if (acceptLang != null && acceptLang.length() != 0) {
         StringTokenizer t = new StringTokenizer(acceptLang, ",; ");

         // get language and convert to java locale format
         String language = t.nextToken().replace('-', '_');

         // set locale onto Alfresco thread local
         locale = I18NUtil.parseLocale(language);
         I18NUtil.setLocale(locale);
      }

      return locale;
3. I have created a Dashlet in the Share which enables a user to change language. The dashlet logic changes the language value stored in the cookie.

Best Regards,
Pawel Rzeszowski.

alfgreen
Champ in-the-making
Champ in-the-making
Hi Pawel,

Can you post the jar file or all class content?

Best Regards,
Javier Garcia

pawel_rzeszowsk
Champ in-the-making
Champ in-the-making
Hi,
the code for the class:
package your.pack.name

import java.util.Locale;
import java.util.StringTokenizer;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

import org.springframework.extensions.surf.mvc.LocaleResolver;
import org.springframework.extensions.surf.util.I18NUtil;


public class CustomLocaleResolver extends LocaleResolver {
   public Locale resolveLocale(HttpServletRequest request) {
      // System.out.println("Entering resolveLocale");

      Locale locale = null;
      Cookie[] cookies = request.getCookies();
      String acceptLang = null;
      // finding ALFRESCO_UI_PREFLANG
      if(cookies != null) {
         for (int i = 0; i < cookies.length; i++) {
            if (cookies[i].getName().equals("ALFRESCO_UI_PREFLANG")) {
               acceptLang = cookies[i].getValue();
               break;
            }
         }
      }
      // if cookie not found, use "Accept-Language"
      // set language locale from browser header
      if (acceptLang == null) {
         acceptLang = request.getHeader("Accept-Language");
      }
      
      if (acceptLang != null && acceptLang.length() != 0) {
         StringTokenizer t = new StringTokenizer(acceptLang, ",; ");

         // get language and convert to java locale format
         String language = t.nextToken().replace('-', '_');

         // set locale onto Alfresco thread local
         locale = I18NUtil.parseLocale(language);
         I18NUtil.setLocale(locale);
      }

      return locale;
   }
}

Regards,
Pawel Rzeszowski.

alfgreen
Champ in-the-making
Champ in-the-making
How you call it to apply the locate?

Best regards

tarn2206
Champ in-the-making
Champ in-the-making
create file your-slingshot-application-context.xml and put in folder $TOMCAT_HOME/shared/classes/alfresco/web-extension

this is the content of xml file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="localeResolver" class="YourLocaleResolver" />
</beans>

fred-xte
Champ in-the-making
Champ in-the-making
Hi to all,

is there any way to make Alfresco Share display in english independently from the to the browser locale ?

Best regards,