掲示板

How to change the location of Language-ext.properties file?

9年前 に Nrupay N Shah によって更新されました。

How to change the location of Language-ext.properties file?

New Member 投稿: 19 参加年月日: 09/12/10 最新の投稿
Hello Friends,

I have a requirement to make language-ext.properties file global, means to put it out of the tomcat and can be read to load all the messages from it to display on portlet pages.
Is it possible to put the Language-ext.properties file out of the class loader and to load it when server up?
If yes, will any body of you please guide me to do so?

Thanks & regards,
Nrupay Shah
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: How to change the location of Language-ext.properties file?

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Okay, it seems that you just don't understand the classpath. The classpath is a series of locations, some of them are internal files (i.e. a named jar), and some of them are directories (WEB-INF/classes). But the classpath can also be an external directory on the filesystem. All you have to do is add it to the java command line.

Note that the portal-ext.properties is outside of tomcat, in the LIFERAY.HOME folder, which is in the class path. So guess what - you can put the language-ext.properties file there and it will work too.
9年前 に Nrupay N Shah によって更新されました。

RE: How to change the location of Language-ext.properties file?

New Member 投稿: 19 参加年月日: 09/12/10 最新の投稿
Hi David,

Thanks for reply, but I want to make the global language.properties file for all plugin portlets.
is it possible?

Thanks & Regards,
Nrupay shah
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: How to change the location of Language-ext.properties file?

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
If you use Liferay's language facilities, it should work.
9年前 に Nrupay N Shah によって更新されました。

RE: How to change the location of Language-ext.properties file?

New Member 投稿: 19 参加年月日: 09/12/10 最新の投稿
Hi David,

Thanks for replying. Can you explain it bit more?
If you use Liferay's language facilities, it should work.

I tried to load external properties file and I get success in reading external properties file, now I just want to put those properties in container.
To put it , i tried to use PortletProps but I am getting null pointer exception when I am trying to use it.
Do you know any other class by which I can put properties at run time which I just read from external file?

Thanks & Regards,
Nrupay Shah
thumbnail
9年前 に Olaf Kock によって更新されました。

RE: How to change the location of Language-ext.properties file?

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
It sounds like you want to read from a constantly updated properties file - this adds quite some burden to the runtime environment. Your load might be sufficiently low to handle this, but typically files on the classpath are loaded once and never again.

A standard Liferay mechanism is to package localization resources in a hook. Once you determine that you want to update the translation, you can redeploy the hook into the running system. This way you have an explicit update point and you're using all the standard mechanisms.

Another option is to investigate Liferay's localization lookup and customize this to take dynamically updated files into account. This is nonstandard though and you'll have to implement it yourself. On the positive side, you're not tied to the classpath any more. On the negative side: It's code that you'll have to write and then maintain.

Choose your poison.
9年前 に Nrupay N Shah によって更新されました。

RE: How to change the location of Language-ext.properties file?

New Member 投稿: 19 参加年月日: 09/12/10 最新の投稿
Hi Olaf,

Thanks for reply.
I got your suggestion on stack overflow as well and I followed that way but I am not able to get translated messages on view.
I have used LanguageResource file and am able to translate those eys but don't know why it is not coming in front side.
Can you please help me on this?

Thanks & Regards,
Nrupay Shah