lib: Update locales for non-VBOOT platforms

This patch sets the default locales to English for platforms that
do not have support for VBOOT configuration. This ensures that the
system will use English locales if the platform does not provide
its own locale settings.

TEST=Built and booted the google/rex platform successfully.

Change-Id: I7554c8bfd58411f460deeb22cf7218059ca8ba9f
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79054
Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/src/lib/ux_locales.c b/src/lib/ux_locales.c
index a2e38fc..0a285d9 100644
--- a/src/lib/ux_locales.c
+++ b/src/lib/ux_locales.c
@@ -116,7 +116,7 @@
 {
 	const char *data;
 	size_t size, offset, name_offset, next_name_offset, next;
-	uint32_t lang_id;
+	uint32_t lang_id = 0; /* default language English (0) */
 	unsigned char version;
 
 	data = locales_get_map(&size, false);
@@ -126,13 +126,15 @@
 		return NULL;
 	}
 
-	/* Get the language ID from vboot API. */
-	lang_id = vb2api_get_locale_id(vboot_get_context());
-	/* Validity check: Language ID should smaller than LANG_ID_MAX. */
-	if (lang_id >= LANG_ID_MAX) {
-		printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n",
-		       __func__, lang_id);
-		lang_id = 0;
+	if (CONFIG(VBOOT)) {
+		/* Get the language ID from vboot API. */
+		lang_id = vb2api_get_locale_id(vboot_get_context());
+		/* Validity check: Language ID should smaller than LANG_ID_MAX. */
+		if (lang_id >= LANG_ID_MAX) {
+			printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n",
+			       __func__, lang_id);
+			lang_id = 0;
+		}
 	}
 
 	printk(BIOS_INFO, "%s: Search for %s with language ID: %u\n",