LRP-614 practice question 1 of 25
The best way to add a new language key to the portal is through:
Full set: 144 questionsA hook plugin is the officially recommended and best method for adding new language keys or overriding existing ones in the Liferay portal. This approach is modular, hot-deployable, and upgrade-friendly, as it does not modify Liferay's core source code. When a hook containing custom Language.properties files is deployed, Liferay's ResourceBundleLoader aggregates these new keys with the existing portal keys, making them available globally. This maintains a clean separation between customizations and the core product, which is a fundamental principle of Liferay development.
A. The Control Panel allows for overriding existing language key values at runtime, but it does not provide a mechanism for adding entirely new keys to the portal's resource bundle.
C. An Ext plugin can achieve this, but it is a much more invasive and heavyweight solution. It is not the "best" way, as hooks were specifically designed for this type of customization.
D. Modifying Liferay's source code directly is the worst practice. It makes applying patches and performing upgrades extremely difficult and is strongly discouraged by Liferay.
1. Liferay Portal 6.2 Developer's Guide, Chapter 5: Customizing Liferay Portal with Hooks, Section: "Customizing Language Keys".
Quote/Paraphrase: The guide explicitly states, "You can use a hook to customize the language keys used in Liferay Portal. You can override Liferay’s default language keys or add your own custom language keys." This section details the process of creating a Language.properties file within a hook to achieve this, confirming it as the standard procedure.
2. Liferay Portal 6.2 Developer's Guide, Chapter 6: Extending Liferay Portal with Ext Plugins, Section: "Deciding Whether to Use a Hook or an Ext Plugin".
Quote/Paraphrase: This section advises developers to "always favor using a hook over using an Ext plugin" for customizations that a hook can handle. It specifically lists "overriding or adding language keys" as a primary use case for hooks, reinforcing that an Ext plugin is not the best choice for this task.
Keep practicing
Take the free LRP-614 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other LRP-614 practice questions
- Question 2In a JSP that includes the tag, the method to check permissions is:
- Question 3A hook plugin can be used to: (Please select all correct answers.)
- Question 4An administrator would like to add a new travel preferences section in the Miscellaneous …
- Question 5The following statements about plugins are true: (Please select all correct answers.)
- Question 6All Service Builder entities contain a local reference to: (Please select all correct ans…
- Question 7A class that extends MVCPortlet must implement:
