Friday, July 20, 2012

Adding Google Translator in a Liferay portal

People always prefer their native language for their convence. To browse a website with a feature of tranlsation is what most of them would like. Liferay provides a feature where in we can have our portal in different languages. This is achieved using  Language-ext.properties file.

But there are few drawbacks in using the above.
The  drawbacks are :
1.This requires a customisation in all the Language_xx.properties file. (For eg. If we want 30 languages option then 30 Language_xx.properties files need to be customised).

2.Even after doing so the entire portal is not changed to the language selected,only the variables mentioned in the  Language_xx.properties file are changed and anything from database is not changed.

So here is the convenient solution of having your portal in different languages by integrating the Google's API in two simple steps

Step1:

Copy and paste the below snippet code in the "portal_normal.vm"
file
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.
translate.TranslateElement({
pageLanguage: 'en',
layout: google.
translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element');
}
</script>
<script src="//
translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Step 2:
We can further change the position of the translate tab. To change the display mode in Horizontal, change the layout to
  layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
For Bottom-right Position:    floatPosition: google.translate.TranslateElement.FloatPosition.BOTTOM_RIGHT
For Bottom-left Position:    floatPosition: google.translate.TranslateElement.FloatPosition.BOTTOM_LEFT

and so on..

To use the the Google's translator only in the selected sections of a website, we can use the below code

<script>
          function googleSectionalElementInit() {
new google.translate.SectionalElement({
sectionalNodeClassName: 'goog-trans-section',
controlNodeClassName: 'goog-trans-control',
background: '#99ff99'
}, 'google_sectional_element');
}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleSectionalElementInit&ug=section&hl=auto"></script>

Add an element with a class name “goog-trans-section”  and a child element with class name “goog-trans-control”. On clicking the parent element, the contents within the child element will be translated.

Note: We can further customise the look and feel of the Google translator toolbar by strictly maintaining the Google trademark and logos.

The following are the merits and demerits of Liferay's translation and other translation APIs (eg. Google Translator)

Liferay's Translation

 Merits  1.Its looks professional
 2.Performance will not be affected.
 3.Translation of the content will be controlled by ourselves.

Demerits

 1.It will not translate Dynamic contents
 2.Static contents need to be mentioned in properties files manually
 3.The number of properties file increases as a number of language increases
 4.For CMS (i.e Web content and page navigations) we need to create articles in the                
respective languages seperately


Google and others Translation tools :

 Merits  1.No need of any properties file changes
 2.Dynamic content as well as static content will be translated in the respective languages
 3.For Web content and page navigations need not create articles in different languages
 4.Imlementation is easy.

De Merits
 1.Performance issue.
 2.The translation control is handled by third party
 3.We need to adhere to the terms & condition of the third party
 4.We don't have control over any issues that are caused by the third party applications .

Sunday, April 15, 2012

Problem in reinstalling mysql

C:\Documents and Settings\All Users\Application Data

in the given location delete the registry file of mysql
and install it again

Friday, March 30, 2012

How to Undeploy a Portlet from Liferay

There Are Many Way To Uninstall a Portlet from Liferay:
Some of them are mention below:-

Method 1:

1. close added application
2. turn off liferay
3. delete the .war in server\default\deploy
4. remove the reference to the Portlets in the PortletPreferences table.


Method 2:

If you use Tomcat, you need to delete also unpacked WAR folder in %tomcat-root%\WEBAPPS.

For instance, if your deployed a TEST1.WAR, folder would be like %tomcat-root%\WEBAPPS\TEST1


Method 3:
Method 3 is the safe method to uninstall any portlet from liferay :-

You could also uninstall portlets through the Update Manager in Control Panel. Another way if you're using tomcat is to delete the folder the portlet is in in wepapps while tomcat is running and it should unregister the portlet.




Hope this ll help :)

Tuesday, March 27, 2012

How to deploy portlets to Liferay

I make first a .war file let's say a portlet of name your_file.war.I wanna have it running on a TOMCAT domain under Liferay portal.
------------------------------------------------------------------------------>

To Use Liferay UI (User Interface). Simply log in with a user allowed to install new portlets and go to Control Panel > Plugin Installation
You will find there a "Install More Portlets" button. Click on it. Then Click on "Upload FIle"
There you have several options:
  • one is to use a local file and upload it this way to the server,
  • an other is download file, when you know where the porlet war file lies on the net,
  • and the default is to use Liferay repository, which means you are going to install a portlet part of one of the suggested online repositories.

Friday, March 23, 2012

How can I change the Liferay bookmark/favorites icon?

There Are Many Methods to Change Bookmark Icon.......... Some of those are mentioned below
hope it will help You..........


Method 1

By dropping your own icon with the same name as the Liferay icon, your icon will appear as the bookmark/favorites icon instead of the Liferay icon.
The icon is located under:

       /Your_Theme/html/themes/example/images/liferay.ico

An example

/portal-web/docroot/html/themes/brochure/images


------If you create your own theme with the Plugin SDK, place the icon in themes/Your_theme/docroot/_diffs/images/liferay.ico


Method 2
Modify your portal-ext.properties file (if it supports that):

#
# Set the theme's shorcut icon.
#
theme.shortcut.icon=liferay.ico

Tuesday, March 13, 2012

Importing Web archive (WAR) files into Eclipse

A Web Archive (WAR) file is a portable, packaged Web application that you can import into your workspace.

Before importing a WAR file, you should first determine if the WAR file contains needed Java™ source files. When importing a WAR file into an existing Web project, the imported Web deployment descriptor files are either not changed or overwritten by the ones included in the imported WAR file, based on your response to the prompt that is provided. In either case, this action does not represent a merging of the two sets of deployment descriptors.

To import the Web project resources in a WAR file into your workspace, complete the following steps:

  1. Select File > Import .
  2. In the Import dialog, select WAR file and then click Next.
  3. Locate the WAR file that you want to import using the Browse button.
  4. The wizard assumes you want to create a new Web project with the same name as the WAR file. If you accept this choice, the project will be created with the same servlet version as specified by the WAR file and in the same location. If you want to override these settings, you can click New and specify your new settings in the Dynamic Web Project wizard.
  5. Click Finish to populate the Web project

Saturday, March 10, 2012

Alfresco

Introduction

Content Management Interoperability Services (CMIS) - a standards proposal consisting of a set of Web services for sharing information among disparate content repositories that seeks to ensure interoperability for people and applications using multiple content repositories. Alfresco, Day Software, Dennis Hamilton, EMC, FatWire, IBM, Microsoft, Open Text, Oracle and SAP have joined forces to propose CMIS.

From 6.0, Liferay provides CMIS hook to support CMIS (version 1.0). Refer to CMIS and Database Migration.

CMIS allows for different CMS systems to interchange information. It is basically JSR-170 with two differences: not Java-specific and document-management-centric.


In Brief

You could integrate Alfresco in the portal in following approaches.

· Web services, referring to the portlet Alfresco Content;

· RESTful services - OpenSearch, referring to the portlet Alfresco Content;

· RESTful services - web scripts, using alfresco as direct repository of Liferay, referring to chapter 6 Customizing the WYSIWYG Editor of the book Liferay Portal 5.2 Systems Development;

· CMIS – using CMIS document library hook;

· Portlets – using alfresco web client as a set of portlets. Refer to integrating-alfresco-web-client-as-a-set-of-portlets-with-liferay

Abstracted from the book: Liferay Portal 6 Enterprise Intranets

This article will introduce how to integrate Alfresco through CMIS in Liferay.



How to Get IT........

In five steps, you should be able to integrate Alfresco through CMIS.

  • Install Liferay portal 6.0 or above at $LIFERAY_HOME; here we use Liferay-Tomcat bundle $TOMCAT_AS_DIR; and $PORTAL_ROOT_HOME = $TOMCAT_AS_DIR/webapps/ROOT;
  • Drop ${alfresco.war} and ${shared.war} to $TOMCAT_AS_DIR/webapps;
  • Create a database alfresco in MySQL.

drop database if exists alfresco;

create database alfresco character set utf8;

grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;

grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;

  • Create a file named portal-ext.properties at $PORTAL_ROOT_HOME/WEB-INF/classes and add following lines in portal-ext.properties.

dl.hook.impl=com.liferay.documentlibrary.util.CMISHook

cmis.credentials.username=admin

cmis.credentials.password=admin

cmis.repository.url=http://localhost:8080/alfresco/service/api/cmis

cmis.repository.version=1.0

cmis.system.root.dir=Liferay Home

That's it. You can start the portal now.


After Integration

Go to Content->Document Library, create a folder "Liferay Home" and upload a document under this folder. Logging in Alfresco as "admin/admin", you would find the folder "Liferay Home" and the document.