[i18n] Crowdin pulls norweigan as no-NO but babel sets as nb-NO #4080

Closed
opened 2020-07-18 04:05:13 +02:00 by flaree · 4 comments
flaree commented 2020-07-18 04:05:13 +02:00 (Migrated from github.com)

Other bugs

What were you trying to do?

Crowdin pulls in Norwegian po files as no-NO.po however Babel's Locale.parse parses no-NO as nb-NO.

What were you expecting to happen?

Norwegian translations to work.

What actually happened?

They didn't render.

How can we reproduce this issue?

  1. [p]set locale no-NO
  2. [p]set showsettings

Babel's Locale.parse() is the issue:

from babel import Locale as BabelLocale
return BabelLocale.parse("no-NO", sep="-")

↑ returns nb-NO, Crowdin pulls in the files as no-NO thus translations don't work.

# Other bugs <!-- Did you find a bug with something other than a command? Fill out the following: --> #### What were you trying to do? Crowdin pulls in Norwegian `po` files as `no-NO.po` however Babel's `Locale.parse` parses `no-NO` as `nb-NO`. #### What were you expecting to happen? Norwegian translations to work. #### What actually happened? They didn't render. #### How can we reproduce this issue? 1. `[p]set locale no-NO` 2. `[p]set showsettings` --- Babel's `Locale.parse()` is the issue: ```py from babel import Locale as BabelLocale return BabelLocale.parse("no-NO", sep="-") ``` ↑ returns `nb-NO`, Crowdin pulls in the files as no-NO thus translations don't work.
Jackenmen commented 2020-07-18 04:42:08 +02:00 (Migrated from github.com)

From quick eval, po files with these names don't have a match in Babel:

no-NO: this locale is called `nb-NO` in Babel
debugging: this locale doesn't exist in Babel
en-PT: this locale doesn't exist in Babel
lol-US: this locale doesn't exist in Babel
sr-SP: this locale doesn't exist in Babel

The relevant eval:

from pathlib import Path

import babel
import redbot

root = Path(redbot.__file__).parent
po_filenames = set()
for path in root.glob("**/locales/*.po"):
    po_filenames.add(path.stem)
for name in po_filenames:
    try:
        locale = babel.Locale.parse(name, "-")
    except babel.UnknownLocaleError:
        print(f"{name}: this locale doesn't exist in Babel")
    else:
        result = f"{locale.language}-{locale.territory}"
        if result != name:
            print(f"{name}: this locale is called `{result}` in Babel")

I'm not entirely sure what's the right way to solve this, but I'm guessing it probably makes most sense to update the relevant language code(s) on Crowdin. I'm guessing debugging locale should be special-cased although I'm not sure what is its purpose.

There's also a lol-US locale in our po files for some reason...

From quick eval, `po` files with these names don't have a match in Babel: ``` no-NO: this locale is called `nb-NO` in Babel debugging: this locale doesn't exist in Babel en-PT: this locale doesn't exist in Babel lol-US: this locale doesn't exist in Babel sr-SP: this locale doesn't exist in Babel ``` The relevant eval: ```py from pathlib import Path import babel import redbot root = Path(redbot.__file__).parent po_filenames = set() for path in root.glob("**/locales/*.po"): po_filenames.add(path.stem) for name in po_filenames: try: locale = babel.Locale.parse(name, "-") except babel.UnknownLocaleError: print(f"{name}: this locale doesn't exist in Babel") else: result = f"{locale.language}-{locale.territory}" if result != name: print(f"{name}: this locale is called `{result}` in Babel") ``` I'm not entirely sure what's the right way to solve this, but I'm guessing it probably makes most sense to update the relevant language code(s) on Crowdin. I'm guessing `debugging` locale should be special-cased although I'm not sure what is its purpose. There's also a `lol-US` locale in our po files for some reason...
Kowlin commented 2020-07-19 10:22:48 +02:00 (Migrated from github.com)

I'm honestly surprised about the existence of lol-US within Crowdin, will take a look at it on Crowdin's side when I get the chance.

I'm honestly surprised about the existence of lol-US within Crowdin, will take a look at it on Crowdin's side when I get the chance.
Kowlin commented 2020-09-03 16:56:18 +02:00 (Migrated from github.com)

So after looking into the case of no-NO and nb-NO, it appears that according to ISO 639-1 (from my understanding) Norwegian has 2 distinct styles of writing. However! Crowdin offers not only the Riksmål and Bokmål dialects, but also a generic Norwegian one. So what Crowdin is doing here is technically correct, but not not in the eyes of Babel.

So after looking into the case of ``no-NO`` and ``nb-NO``, it appears that according to [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (from my understanding) Norwegian has [2 distinct styles of writing](https://en.wikipedia.org/wiki/Norwegian_language#Bokm%C3%A5l_and_Nynorsk). However! Crowdin offers not only the Riksmål and Bokmål dialects, but also a generic Norwegian one. So what Crowdin is doing here is technically correct, but not not in the eyes of Babel.
Kowlin commented 2020-09-03 17:19:48 +02:00 (Migrated from github.com)

I've replaced Crowdin's generic no-NO with nb-NO as recommended by Norwegian speakers them self. This will be reflected on the next Crowdin push I'm gonna do in a second, and in the next version of Red.

I've replaced Crowdin's generic ``no-NO`` with ``nb-NO`` as recommended by Norwegian speakers them self. This will be reflected on the next Crowdin push I'm gonna do in a second, and in the next version of Red.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#4080
No description provided.