Add custom translation Strings to liferay theme - java

I want to add some Translations to my Theme to call it with #language("key") in my template.vm files.
After googling around I have still no clue where to place the Language.properties files.
Is it even possible to add Translations to a Theme? If so where I have to place these files?
Thx in advance - Florian

Create a hook to override the language files.
Refer Overriding language in below link

It is very simple.. Add your "custom-key" on portal-impl.jar file for the language specific properties files.
You could able to find language properties at portal-impl.jar\content\Language.properties.
On .vm file add #language("custom-key").
Restart the server.
Thanks & Regards,
Thiyagu.L

Please check this image and hope it is helpful for you
In words create a folder docroot/WEB-INF/src folder this three are not different folder if you see in your project in your package explorer then this is the first folder inside your project.
Thanks and regards
asif aftab

Related

How to remove the compass from nasa worldwind

I am working on a project related with nasa worldwind.
Can anybody explain how can I remove the compass ,which is
located at the top right of screen.
simply remove the following code from your Javascript file:
wwd.addLayer(new WorldWind.CompassLayer());
Good luck !
Since you've tagged the question with swing and java tags I assume you are referring to WorldWindJava and the solution in the other answer related to WebWorldWind will not work. To remove the compass layer from WorldWind you can do it either programmatically or via the worldwind.layers.xml file.
For a programmatic approach you can look at this question:
How to Hide(or remove the) Standard layer (like star,atmosphere,earth at night) in World wind java
and then call that method there as: removeLayerWithName("Compass").
The XML configuration file approach is the easiest and you can see a full example of the worldwind.layers.xml file here. So, basically you copy that file, remove the:
<Layer className="gov.nasa.worldwind.layers.CompassLayer"/>
entry there at the bottom. You then need to place this file in a folder that is located in your application's current-working-directory. I suggest you give it a unique name to differentiate it from the default worldwind.layers.xml file for example worldwind.custom.layers.xml. You then need to specify that WorldWind should use this custom file by modifying the worldwind.xml file. You can get a template of this file here. Copy this file to the same folder in your application's current-working-directory. Also give it a different name like worldwind.custom.xml. You then need to modify this entry:
<LayerList href="config/worldwind.layers.xml"/>
in worldwind.custom.xml to point to your file like so:
<LayerList href="some-folder/worldwind.custom.layers.xml"/>
Lastly, you need to specify that WorldWind should use your custom configuration file via the gov.nasa.worldwind.app.config.document system property. So, if you have a script to launch your app you add the following in your run.sh file:
java -cp "...classpath-stuff" -Dgov.nasa.worldwind.app.config.document="some-folder/worldwind.custom.xml" com.example.MainClass

How can I change the name of *.xml file in the eclipse IDE's project explorer with one of its element

I m trying to write an eclipse plugin which is suppose to render xml file some different manner. What actually I want is to replace the name of the file displayed in the project explorer with one of its element without originally change the file name. for example I have a file named 1234.xml with content
<name> dinesh </dinesh>
<college> NITT </college>
So I want to change the name of 1234.xml to dinesh.xml in the project explorer.
Can anybody tell me what are the possible ways I can achieve this.
I am new to eclipse plugin development. So please provide me as much information as possible.
There is no automatic way (I mean refactor) for this, so you must manually do it:
Change name of file 1234.xml to dinesh.xml
Search in your project all references to 1234.xml with CTRL + H / file search and appropiate patterns:
Change all references found of 1234.xml to dinesh.xml
If some issue appears search for 1234 in all the files to check if file was references only by name
Well I find the answer of what I wanted to do...
I have extended decorator extension point of eclipse to provide custom label provider for the desired files ...
One more thing to access the xml attribute use regex instead of xml parsing . It will make things bit faster than xml parsing ...
Thanks

loading an image from resources folder using relative path

How to set the images in background of shell using relative path. I have image which resides in folder "res". I am adding screen shot here, just you to have better understanding of 'directory structure' as well as my question(in case if it seemed little ambiguous to you). Any suggestion and help will be appreciated.
The SplashWindow.jpg is placed next to the class notDltNow which you specify as the reference for relative paths, so you can simply write:
shell.setBackgroundImage(SWTResourceManager.getImage(
notDltNow.class, "SplashWindow.jpg"));
It is also a good idea to put resources inside the src folder so when you export your code e.g. into a jar, the resources will also be exported and still available to the code without additional hassle.
In order to read your images from resources folder, you need to :
add res folder to classpath
locate file absolutely, i.e. "/res/SplashWindow.jpg"
Hope this helps

Where to put smartgwt icons folder in project tree?

setNodeIcon("icons/person.png");
or
setIcon("icons/person.png");
In respectively SmartGWT TreeGrid and Tab (in TabSet) should find "person.png" in folder "icons" I guess but where should I put "icons" in the project itself?
In the JavaDoc it's also said that the default value for setNodeIcon is [SKIN]file.gif what does [SKIN] mean ?
Thanks
I don't know where you find the default value (to my sense this use of the Skin folder is for using images already in the smartgwt skin)but any way I usually put my images directly in the war in my project with subfolder related to their size.
To use the icon I simply do for example btnClear.setIcon("16/clear.png");
With war/images/16.clear.png image folders structure.
You can have a look at getSkinImgDirand do a test

Changing "Favorites" Tooltip in Java Help

In my helpset file, I'm declaring a favorites view, using
<view>
<name>Lesezeichen</name>
<label>Lesezeichen</label>
<type>javax.help.FavoritesView</type>
<data></data>
</view>
This automatically adds an appropriate button to the toolbar (in the swing application). Unfortunately, the tooltip of the button reads "Add to favorites". I would like to replace this by my own text, but didn't find anything about this in the documentation or using a google search. Any ideas or pointers?
Disclaimer: I already posted this question to JavaRanch, didn't get an answer yet, though.
If you extract the src.jar (rename it to src.zip and extract) and open the java class jh2.0/src/src/javax/help/resources/Constants.java you will notice that in the section
// Tooltips for Actions
is located entry for localization:
{ "tooltip.FavoritesAction", "Add to Favorites"},
This constant is missing from the jh2.0/src/src/javax/help/resources/Constants_de.java which is used in your case. Just add the right translation, compile the source or just this class and add it to the jh.jar (you may treat the jar as a simple zip archive)
Yes, I know this is dirty hack, but generally JavaHelp is quite useful
Now this sounds weird.
The ResourceBundle mechanism supports to "override" the class resource content by using a .properties file with the resource bundle.
Try placing the looked up resource bundle as a properties file in the respective folder denoted by the bundle name.
E.g. if HelpUtilities looks after javax.help.resources.Constants by calling
ResourceBundle.getBundle("javax.help.resources.Constants", locale);
you'd be placing your file in a folder structure at /javax/help/resources/Constants_de_DE.properties. This must be located in your applications "working directory".

Categories