Skip to content

Commit 159b60c

Browse files
authored
Fix: interop CSN i18n: use "-" as separator for language keys (#279)
1 parent 1a7c32a commit 159b60c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

__tests__/__snapshots__/ord.e2e.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ exports[`Tests for Data Product definition Check interop CSN content 1`] = `
18521852
"Stock": "Stock",
18531853
"UserID.Description": "User's unique ID",
18541854
},
1855-
"en_US_saptrc": {
1855+
"en-US-saptrc": {
18561856
"ChangedAt": "8v5EfaWMYC2dmCGnaCSSUA_Changed On",
18571857
"ChangedBy": "y0d7F56RLGVZiTV7YHU7Iw_Changed By",
18581858
"CreatedAt": "CJxeZDpLHdREwzDQeluRuA_Created On",
@@ -1884,7 +1884,7 @@ exports[`Tests for Data Product definition Check interop CSN content 1`] = `
18841884
"Stock": "Stock",
18851885
"UserID.Description": "ID único de usuario",
18861886
},
1887-
"es_MX": {
1887+
"es-MX": {
18881888
"ChangedAt": "Fecha de modificación",
18891889
"ChangedBy": "Autor de modificación",
18901890
"CreatedAt": "Fecha de creación",
@@ -2284,7 +2284,7 @@ exports[`Tests for Data Product definition Check interop CSN content 1`] = `
22842284
"Stock": "Stock",
22852285
"UserID.Description": "ID duy nhất của người dùng",
22862286
},
2287-
"zh_CN": {
2287+
"zh-CN": {
22882288
"ChangedAt": "更改日期",
22892289
"ChangedBy": "更改人",
22902290
"CreatedAt": "创建日期",
@@ -2300,7 +2300,7 @@ exports[`Tests for Data Product definition Check interop CSN content 1`] = `
23002300
"Stock": "Stock",
23012301
"UserID.Description": "用户的唯一标识",
23022302
},
2303-
"zh_TW": {
2303+
"zh-TW": {
23042304
"ChangedAt": "更改日期",
23052305
"ChangedBy": "更改者",
23062306
"CreatedAt": "建立日期",

lib/interopCsn.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function add_i18n_texts(csn) {
1919
// get all texts of the app
2020
const i18n = [...(localize.bundles4(csn) || [])]
2121
.filter(([locale]) => !!locale)
22+
.map(([locale, value]) => [locale.replaceAll('_', '-'), value]) // CSN interop uses '-' as separator
2223
.reduce((all, [locale, value]) => ({ ...all, [locale]: value }), {});
2324

2425
// get all i18n keys referenced in the csn

0 commit comments

Comments
 (0)