Tribune

Home » Liferay Portal » English » 2. Using Liferay » General

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Jose Alvarez de Lara
How to set default locale (Idiom)
31 dicembre 2012 1.31
Risposta

Jose Alvarez de Lara

Punteggio: Junior Member

Messaggi: 45

Data di Iscrizione: 10 dicembre 2012

Messaggi recenti

Hi,

Here is my portal-ext.properties file where I am to try to set my default locale,

1
2company.default.locale=es_ES,en_US
3company.default.time.zone=Europe/Paris
4locales=es_ES,en_US


What I am pretending is that in both my private a public pages appears only
the flag of US and Spain but instead of it appears all the flags.

How must I do?

Regards
Jose

PS
Happy new year emoticon
Milen Dyankov
RE: How to set default locale (Idiom)
31 dicembre 2012 3.29
Risposta

Milen Dyankov

LIFERAY STAFF

Punteggio: Regular Member

Messaggi: 237

Data di Iscrizione: 30 ottobre 2012

Messaggi recenti

The poral.properties file is one of best self-documented resources in Liferay. If you look at the comment for the property you are modifying it says:
1    #
2    # This sets the default locale of the portal, overriding the properties
3    # "user.language" and "user.country" specified in system.properties.
4    #
5    #company.default.locale=en_US


As you can see it has nothing to do with what locales are actually available. The property you need to modify is
 1    #
 2    # Specify the available locales. Messages corresponding to a specific
 3    # language are specified in properties files with file names matching that
 4    # of content/Language_*.properties. These values can also be overridden in
 5    # properties files with file names matching that of
 6    # content/Language-ext_*.properties. Use a comma to separate
 7    # each entry.
 8    #
 9    # If there is more than one locale for the same language, the first one in
10    # the list will be used when a translation is requested in another locale of
11    # the same language but a translated value cannot be found. For example, if
12    # there are two locales such us pt_BR and pt_PT (in this order), any key not
13    # found in pt_PT will be looked for in pt_BR.
14    #
15    # All locales must use UTF-8 encoding.
16    #
17    # See the following links specifiy language and country codes:
18    #     http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt
19    #     http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
20    #
21    locales=ar_SA,eu_ES,bg_BG,ca_AD,ca_ES,zh_CN,zh_TW,hr_HR,cs_CZ,da_DK,nl_NL,nl_BE,en_US,en_GB,en_AU,et_EE,fi_FI,fr_FR,fr_CA,gl_ES,de_DE,el_GR,iw_IL,hi_IN,hu_HU,in_ID,it_IT,ja_JP,ko_KR,lo_LA,lt_LT,nb_NO,fa_IR,pl_PL,pt_BR,pt_PT,ro_RO,ru_RU,sr_RS,sr_RS_latin,sl_SI,sk_SK,es_ES,sv_SE,tr_TR,uk_UA,vi_VN


And one more thing to note is that you can actually change this through Control Panel -> Portal Settings -> Display Settings. However if you do so your locale settings will be stored into database and the value of locales property in portal-ext.properties will not be taken into account.
Hitoshi Ozawa
RE: How to set default locale (Idiom)
31 dicembre 2012 3.43
Risposta

Hitoshi Ozawa

Punteggio: Liferay Legend

Messaggi: 7949

Data di Iscrizione: 23 marzo 2010

Messaggi recenti

Milen,

Look at Jose's settings. locales is already being set.

locales=es_ES,en_US


He probably didn't re-start liferay after changing the properties or have saved the settings in the Control Panel. Since liferay does not have function to delete properties once they are saved to a database, the best solution to Jose is to ask his to set available languages in Control Panel (Control Panel -> Portal Settings -> Display Settings).
Milen Dyankov
RE: How to set default locale (Idiom)
31 dicembre 2012 6.18
Risposta

Milen Dyankov

LIFERAY STAFF

Punteggio: Regular Member

Messaggi: 237

Data di Iscrizione: 30 ottobre 2012

Messaggi recenti

Hitoshi,
you are right (as usual). What scares me though is that this is the second time in the last week I'm failing to notice something in the provided snipped. Wander if it is me getting old or it is this time of the year when ... oh well, never mind.

Jose,
please ignore the first part of my answer above. If you want to check the actual value of the property have a look it the table in Control Panel ->
Server Administration -> Properties -> Portal Properties. If it is set to something different then what you have in your portal-ext.properties - the value was probably set in the Control Panel and stored in the database. Try to change it in Control Panel or delete it from the database.

There is of course a chance that your portal-ext.properties was not found by the portal but I guess you would notice that non of your customizations are applied if that was the case.
Jose Alvarez de Lara
RE: How to set default locale (Idiom)
31 dicembre 2012 22.43
Risposta

Jose Alvarez de Lara

Punteggio: Junior Member

Messaggi: 45

Data di Iscrizione: 10 dicembre 2012

Messaggi recenti

Hi,

Thanks for reply. Yes I have set it to es_Es in the database by using the Control Panel
so you say I need to delete from datebase and set in portal-ext.properties.

I am gonna try and tell you.

Best regards,
Jose
Jose Alvarez de Lara
RE: How to set default locale (Idiom)
31 dicembre 2012 23.17
Risposta

Jose Alvarez de Lara

Punteggio: Junior Member

Messaggi: 45

Data di Iscrizione: 10 dicembre 2012

Messaggi recenti

Hi,

This is what I did. I have set the languageId column to null before start the portal and in the properties file I have locale=es_Es, en_US.
I have started the portal and in the languageId column only appears en_US.

On the other hand I have all the country flags in both my private an public pages.

The question is thai I had a bad configuration of my portal being deployed on glassfish 3.1.2.2. I redeployed it an remove those properties about
the locale and now I do not remember how I had it.

I know there is a way to do it because I copied from the properties example of an italian liferay fellow but I do not remember that way.

Any idea?

Regards,
Jose
Jelmer Kuperus
RE: How to set default locale (Idiom)
1 gennaio 2013 4.26
Risposta

Jelmer Kuperus

Punteggio: Liferay Legend

Messaggi: 1192

Data di Iscrizione: 10 marzo 2010

Messaggi recenti

Try running this piece of sql and inspect the result to see if the locale property is in there:

1select p.preferences
2from portalpreferences p, company c
3where p.ownerId = c.companyId;


Settings stored in the database take precedence over what's in the property files
Jose Alvarez de Lara
RE: How to set default locale (Idiom)
1 gennaio 2013 12.56
Risposta

Jose Alvarez de Lara

Punteggio: Junior Member

Messaggi: 45

Data di Iscrizione: 10 dicembre 2012

Messaggi recenti

Hi

I am afraid I choose the worst way, I decided to redeploy liferay-6.2.0-ce-m2
on glassfish and I am having troubles.

I have opened a new thread but anyway thanks a lot, I will keep your post in mind
if I have problems with my new portal.

Best regards,
Jose