summaryrefslogtreecommitdiffstats
path: root/src/include/ux_locales.h
diff options
context:
space:
mode:
authorHsuan Ting Chen <roccochen@chromium.org>2023-05-02 17:55:50 +0800
committerMartin L Roth <gaumless@gmail.com>2023-06-04 19:00:18 +0000
commit3c2cdb6e570b7c8f05880b12dd7bc179858f6e1f (patch)
tree536d712b7910333cf5e98b7731d13fb9c9226115 /src/include/ux_locales.h
parentba5a2a189ef8594b773888f94ef9fd3ffa199fc4 (diff)
downloadcoreboot-3c2cdb6e570b7c8f05880b12dd7bc179858f6e1f.tar.gz
coreboot-3c2cdb6e570b7c8f05880b12dd7bc179858f6e1f.tar.bz2
coreboot-3c2cdb6e570b7c8f05880b12dd7bc179858f6e1f.zip
lib: Support localized text of memory_training_desc in ux_locales.c
To support the localized text, we need to get the locale id by vboot APIs and read raw string content file: preram_locales located at either RO or RW. The preram_locales file follows the format: [string_name_1] [\x00] [locale_id_1] [\x00] [localized_string_1] [\x00] [locale_id_2] [\x00] [localized_string_2] ... [string_name_2] [\x00] ... This code will search for the correct localized string that its string name is `memory_training_desc` and its locale ID matches the ID vb2api returns. If no valid string found, we will try to display in English (locale ID 0). BUG=b:264666392 BRANCH=brya TEST=emerge-brya coreboot chromeos-bmpblk chromeos-bootimage Change-Id: I7e3c8d103c938a11b397c32c9228e44e31c3f01d Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/75330 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/include/ux_locales.h')
-rw-r--r--src/include/ux_locales.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/ux_locales.h b/src/include/ux_locales.h
new file mode 100644
index 000000000000..1affd925d14c
--- /dev/null
+++ b/src/include/ux_locales.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _UX_LOCALES_H_
+#define _UX_LOCALES_H_
+
+#include <types.h>
+
+/* 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.
+ * 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);
+
+#endif // _UX_LOCALES_H_