Describe the bug
Using PostreSQL database, the "locales"."code" column is generated with lenth 2, but some locales are greater (e.g. pt-br). This causes error when downloading and storing translation. I changed the column's length on database, and I was able to download, but when applying the locale, the following error occurs in the frontend:
Error: GraphQL error: Invalid locale or namespace
at new n (app.265ad7c3872cfbfd74b6.js:2)
at app.265ad7c3872cfbfd74b6.js:2
at app.265ad7c3872cfbfd74b6.js:2
at Set.forEach (<anonymous>)
at app.265ad7c3872cfbfd74b6.js:2
at Map.forEach (<anonymous>)
at e.broadcastQueries (app.265ad7c3872cfbfd74b6.js:2)
at app.265ad7c3872cfbfd74b6.js:2
at Object.next (app.265ad7c3872cfbfd74b6.js:1468)
at _ (app.265ad7c3872cfbfd74b6.js:1468)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Should works.
Host Info:

Edit:
Errors also occurs when creating pages for these locations, because columns like "pages"."localeCode", "pageHistory"."localeCode" are in wrong size.
Fixed by 08fd10603f7fdfdbe98bffe37e92630f11db2f91
Good catch, this was a big oversight on my part.
Unfortunately, this will require a re-install in order to use these locales as the code is a primary key and cannot be altered by a standard migration (at least not without creating a bunch of temporary tables and moving stuff around).
@NGPixel thanks for the quick answer.
What about the GraphQL error in frontend?
I still have this bug
Hi folks,
I founded the frontend error, when GraphQL request translate bundle from backend is sended "pt-BR", but in database language code is saved as "pt-br", so when the backend try to find translation it cause an Exception, see images below.
File: server/core/localization.js
async getByNamespace(locale, namespace) {
if (this.engine.hasResourceBundle(locale, namespace)) {
let data = this.engine.getResourceBundle(locale, namespace)
return _.map(dotize.convert(data), (value, key) => {
return {
key,
value
}
})
} else {
throw new Error('Invalid locale or namespace')
}
}
Database line

Frontend Locale Request
Most helpful comment
I still have this bug