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-hook
and Display name asLanguage 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.
-
With
language-key-hook
set 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/src
folder of thelanguage-key-hook
and open theLanguage_en.properties
file in thecontent
package. -
Add the following language key to the file and Save it:
show-page-title = Show Page Title
-
Deploy the
language-key-hook
to 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-title
theme 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.