From 6ae7b05117bfb9a910f69ffd244c670eb8c5e463 Mon Sep 17 00:00:00 2001 From: Xie Zhihao Date: Mon, 22 Jan 2024 00:21:14 +0800 Subject: [PATCH] Support of country and its subdivision and script --- index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b42ab21..e07225a 100644 --- a/index.js +++ b/index.js @@ -22,9 +22,15 @@ function withAndroidLocalizedName(config) { resources.push({ string: { $: { name: key }, _: strings[key] } }); } if (resources.length) { - await fs.promises.mkdir(path.resolve(resPath, `values-${locale}`), { recursive: true }); + let finalLocale = locale; + if (finalLocale.includes("-")) { + finalLocale = `b+${finalLocale.replaceAll("-", "+")}`; + } + await fs.promises.mkdir(path.resolve(resPath, `values-${finalLocale}`), { + recursive: true, + }); await fs.promises.writeFile( - path.resolve(resPath, `values-${locale}`, 'strings.xml'), + path.resolve(resPath, `values-${finalLocale}`, 'strings.xml'), builder.buildObject({ resources }) ); }