Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multilingual field exceptions #9124

Merged
merged 5 commits into from
May 21, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modules/ui/fields/localized.js
Original file line number Diff line number Diff line change
@@ -122,7 +122,10 @@ export function uiFieldLocalized(field, context) {
var existingLangs = new Set(existingLangsOrdered.filter(Boolean));

for (var k in tags) {
var m = k.match(/^(.*):(.*)$/);
// matches for field:<code>, where <code> is a BCP 47 locale code
// motivation is to avoid matching on similarly formatted tags that are
// not for languages, e.g. name:left, name:source, etc.
var m = k.match(/^(.*):([A-Za-z]{2,3}(?:-[A-Za-z]{4})?)$/);
1ec5 marked this conversation as resolved.
Show resolved Hide resolved
if (m && m[1] === field.key && m[2]) {
var item = { lang: m[2], value: tags[k] };
if (existingLangs.has(item.lang)) {