To create custom language keys, you must create a hook plugin to modify
language_en.properties. Follow the steps below to create the hook:
Open IDE/Developer Studio and goto File → New → Liferay Plugin Project.
Set the Project name as
language-key-hookand Display name as
Language Key Hook.
Set the proper SDK and runtime, select Hook for the Plugin type, and click Finish.
The foundation for the hook is created. Next you need to configure the hook. In this case, you’ll modify the English US language properties, but the same process can be used to hook into any existing language properties file.
Right-click the language key hook you just created in the package explorer on the left and select New → Liferay Hook Configuration.
language-key-hookset as the Hook plugin project select Language properties for the hook type and click Next.
Leave the default Content folder and click Add.
Enter Language_en.properties for the property file, click OK and Finish.
The file should open for you. If it doesn’t, open the
docroot/WEB-INF/srcfolder of the
language-key-hookand open the
Language_en.propertiesfile in the
Add the following language key to the file and Save it:
show-page-title = Show Page Title
language-key-hookto the server and wait for the changes to publish.
Once the changes have published, click the Edit button and open the Look and Feel drop-down panel. The
show-page-titletheme setting is now using the language key you just created!
Excellent! The theme settings now all have language keys! In the next portion of the Learning Path you’ll expand your CSS further by making the Lunar Resort theme responsive to mobile devices.