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

Fix Python xbmc.getLanguage() return when UI language has regional variant #25062

Closed
wants to merge 1 commit into from

Conversation

scott967
Copy link
Contributor

Description

ModuleXbmc.cpp function getLanguage
The UI language was failing to return correct ISO 639-1 and ISO 639-2 language and optional region codes when UI language is set to a language with a regional variant -- for example, English (New Zealand). This fix splits the language English Name at " (" so only the language name is used when retrieving the language codes.

Motivation and context

Fix for #24990

How has this been tested?

Tested on Windows 10 x64 with OS locale en-us. Python addon created to call xbmc.getLanguage([format], [region]) for all 6 possible cases, including region=True and region=False.

What is the effect on users?

Addons using xbmc.getLanguage() will work properly.

Screenshots (if appropriate):

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • Student submission (PR was done for educational purposes and will be treated as such)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@scott967
Copy link
Contributor Author

It should be noted that the "region" returned by this function is the user UI setting "region default format", not necessarily the region associated with the language name.

fix 2

Update ModuleXbmc.cpp

improve style

Jenkins
@scott967
Copy link
Contributor Author

scott967 commented May 1, 2024

Updated with Jenkins format

@scott967
Copy link
Contributor Author

From a quick review I think #23110 accomplishes this in a better design so am closing this to focus on that PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant