lib: Refactor ux_locales_get_text API
This patch refactors the `ux_locales_get_text` API to handle fallback text (English) internally, rather than relying on the caller. It introduces message IDs for lookups, enabling the API to locate both the UX locale name and fallback text based on the ID. With this patch, `ux_locales_get_text` API locates UX locales message based on message ID. `ux_locales_get_text` retrieves fallback text message depending upon the message ID if UX locales is not available. This centralizes fallback handling and simplifies adding future messages without per-SoC duplication. BUG=b:339673254 TEST=Built and booted google/brox. Verified eSOL display. Change-Id: I4952802396265b9ee8d164d6e43a7f2b3599d6c0 Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/86283 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
ff353fe88d
commit
121ab8e201
5 changed files with 85 additions and 75 deletions
|
|
@ -5,14 +5,19 @@
|
|||
|
||||
#include <types.h>
|
||||
|
||||
enum ux_locale_msg {
|
||||
UX_LOCALE_MSG_MEMORY_TRAINING,
|
||||
UX_LOCALE_MSG_NUM,
|
||||
};
|
||||
|
||||
/* Unmap the preram_locales if it has been mapped. No-op otherwise. */
|
||||
void ux_locales_unmap(void);
|
||||
|
||||
/*
|
||||
* Get the localized text for a given string name.
|
||||
* Get the localized text for a given message ID as per `enum ux_locale_msg`.
|
||||
* This function will try to read the language ID from vboot API, and search the
|
||||
* corresponding translation from CBFS preram_locales.
|
||||
*/
|
||||
const char *ux_locales_get_text(const char *name);
|
||||
const char *ux_locales_get_text(enum ux_locale_msg msg_id);
|
||||
|
||||
#endif // _UX_LOCALES_H_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue