Fórum

Language portlet with [Beta] suffix!

Adel Bayoudh, modificado 9 Anos atrás.

Language portlet with [Beta] suffix!

Junior Member Postagens: 47 Data de Entrada: 05/08/14 Postagens Recentes
hello,
My problem is that the language portlet display a list of languages ​​with [Beta] suffix . how I can display the languages ​​without seeing the word [Beta].
A picture of my portlet is attached for better understanding)

Best regards
thumbnail
Pankaj Kathiriya, modificado 9 Anos atrás.

RE: Language portlet with [Beta] word !

Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
In portal.properties, you will find list of locales which are listed as beta by property locales.beta.

For each of this listed locale it will show Beta label as suffix to language name, refer code of portal-web\docroot\html\taglib\ui\language\page.jsp.

You can remove your locale from property locale.beta in portal-ext.properties file to remove beta label.
Adel Bayoudh, modificado 9 Anos atrás.

RE: Language portlet with [Beta] word !

Junior Member Postagens: 47 Data de Entrada: 05/08/14 Postagens Recentes
hello,
where I can find my portal.properties?
when I search in my tomcat folder I find multiple files with this name!
I am using the 6.2 liferay version.

thank you
thumbnail
Pankaj Kathiriya, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
In Liferay source you will find at location "\portal-impl\src\portal.properties".

You have to override locales.beta property in portal-ext.properties. You can place portal-ext.properties file parallel to tomcat folder or under tomcat/webapps/ROOT/classes/
Adel Bayoudh, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 47 Data de Entrada: 05/08/14 Postagens Recentes
Thank you, it works!
thumbnail
Ahmed bouchriha, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 55 Data de Entrada: 04/05/12 Postagens Recentes
Hi,

For the people that don't want to override Liferay language properties you can remove the [beta] suffix with
javascript or jquery using the following code :

JavaScript Code :

window.onload=function(){
var  langList = document.getElementsByClassName('taglib-language-list-text');
if(langList){
		for(var i=0; i<langlist.length; i++) { var langtxt="langList.item(i).innerText.replace(&quot;[Beta]&quot;,&quot;&quot;);" langlist.item(i).text="langTxt" ; } };< code></langlist.length;>
<br><br>jQuery Code :<br><br><pre><code>jQuery(document).ready(function() { if($('.taglib-language-list-text')){ $('.taglib-language-list-text').each(function( index ) { var langTxt = $(this).text().replace("[Beta]",""); $(this).text(langTxt); }); } });</code></pre><br><br>The above snippets can be placed on the theme or on the custom javascript field on the site manage pages.<br>Solution tested on LR 6.1, LR 6.2.<br><br><a href="https://www.themeray.com">Themeray</a><br><br>Best Regards
Adel Bayoudh, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 47 Data de Entrada: 05/08/14 Postagens Recentes
I tested with JQuery and it works for me emoticon
thumbnail
Ahmed bouchriha, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 55 Data de Entrada: 04/05/12 Postagens Recentes
Glad to hear that emoticon
fouad fouad, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 28 Data de Entrada: 08/08/14 Postagens Recentes
sorry man, but i didnt know how to place the code.
thank you
Adel Bayoudh, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 47 Data de Entrada: 05/08/14 Postagens Recentes
hello,
you need to insert it into the file portal_normal.vm in your theme.
fouad fouad, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 28 Data de Entrada: 08/08/14 Postagens Recentes
yes man, i did, but nothing chganged.
i have an embeded language portlet in my theme

#set ($VOID = $velocityPortletPreferences.setValue('displayStyle', '2'))
#set ($VOID = $velocityPortletPreferences.setValue('languageIds', 'en_US,ar_SA,fr_FR'))
#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($portlet_id = '82')
#set ($my_portlet_id = "${portlet_id}_INSTANCE_5874")
$theme.runtime($my_portlet_id, "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()

then i added your code

<script>
window.onload=function(){
var langList = document.getElementsByClassName('taglib-language-list-text');
if(langList){
for(var i=0; i<langList.length; i++)
{
var langTxt = langList.item(i).innerText.replace("[Beta]","");
langList.item(i).text = langTxt ;
}
}
</script>

but nothing changed emoticon
Adel Bayoudh, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 47 Data de Entrada: 05/08/14 Postagens Recentes
trying it with

<script type="text/javascript">
jQuery(document).ready(function() {
if($('.taglib-language-list-text')){
$('.taglib-language-list-text').each(function( index ) {
var langTxt = $(this).text().replace("[Beta]","");
$(this).text(langTxt);

});
}
});

</script>
fouad fouad, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 28 Data de Entrada: 08/08/14 Postagens Recentes
hello Adel Bayoudh

i tried it too, but no success emoticon.
should i add any jquery file too? or should i add something else?

thank you in advance
Adel Bayoudh, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 47 Data de Entrada: 05/08/14 Postagens Recentes
yes you need a jquery file

<script src="$themeDisplay.getPathThemeRoot()/js/jquery.min.js"></script>

if you use firefox install a firebug plugin and you can see later a javascript error !
fouad fouad, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 28 Data de Entrada: 08/08/14 Postagens Recentes
i added the jquery file inside _diffs/js folder
and i included it as u mentioned in portal_normal.vm

nothing changed, i have firbug, i went to scripts tab and i saw that the jquery file is being read successfully.

so what the problem do u thinnk?
fouad fouad, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 28 Data de Entrada: 08/08/14 Postagens Recentes
its working fine now emoticon thank you man
Tomas Augustaitis, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

New Member Postagens: 6 Data de Entrada: 15/10/13 Postagens Recentes
@Ahmed bouchriha
Nice js approach.
I did the same thing by creating hook and overriding ROOT\html\taglib\ui\language\page.jsp line 128 from

localeDisplayName = LocaleUtil.getShortDisplayName(locales[i], duplicateLanguages);

to

localeDisplayName = LocaleUtil.getShortDisplayName(locales[i], duplicateLanguages).replace(" [Beta]", "");
thumbnail
Ahmed bouchriha, modificado 9 Anos atrás.

RE: Language portlet with [Beta] suffix!

Junior Member Postagens: 55 Data de Entrada: 04/05/12 Postagens Recentes
Hi Tomas

Glad to hear that my solution helped you emoticon.

Good job for the hook it will rmove the beta prefix independently of the theme.

Best Regards