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

[Python] xbmc.getRegion('time') returns wrong scheme if language is set to German #23974

Closed
2 of 7 tasks
b-jesch opened this issue Oct 21, 2023 · 7 comments · Fixed by #24009
Closed
2 of 7 tasks

[Python] xbmc.getRegion('time') returns wrong scheme if language is set to German #23974

b-jesch opened this issue Oct 21, 2023 · 7 comments · Fixed by #24009
Labels
Resolution: Fixed issue was resolved by a code change Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it

Comments

@b-jesch
Copy link

b-jesch commented Oct 21, 2023

Bug report

Describe the bug

xbmc.getRegion('time') returns '%H:mm:ss' instead of the correct scheme '%H:%M:%S' when language settings is set to "German".

From an addon that calculate some time expression, the xbmc.getRegion('time') is processed and logged. For a german language setting xbmc.getRegion('time') returns '%H:mm:ss' instead of '%H:%M:%S'. As a result time calculations with <dateobject>.strftime() will fail. If region is set to english, all is ok (returns '%I:%M:%S %p').

Expected Behavior

Here is a clear and concise description of what was expected to happen:

Until Nexus the time scheme calculation is ok. Please revert or correct this.

Actual Behavior

xbmc.getRegion('time') returns wrong scheme if german language is selected.

Possible Fix

To Reproduce

Steps to reproduce the behavior:

  1. set Kodi to german language
  2. create an addon or script that logged xbmc.getRegion('time')

Debuglog

The debuglog can be found here: There's no complete debug.log as the following snippet describes the problem:

2023-10-21 16:24:11.804 T:4153     info <general>: [script.knftv.announcer 3.1.6+matrix] Local time format of client: %d.%m.%Y %H:mm:ss
2023-10-21 16:24:11.830 T:4153    error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'ValueError'>
                                                   Error Contents: time data '21.10.2023 20:15' does not match format '%d.%m.%Y %H:mm:ss'

Screenshots

Here are some links or screenshots to help explain the problem:

Additional context or screenshots (if appropriate)

Here is some additional context or explanation that might help:

Your Environment

Used Operating system:

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required.
Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

@xbmc-gh-bot xbmc-gh-bot bot added the Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it label Oct 21, 2023
@DeltaMikeCharlie
Copy link
Contributor

DeltaMikeCharlie commented Oct 26, 2023

@b-jesch - This issue sounds similar to a PR regarding date format: #22982

What ‘German’ locale are you using and what does your time format look like in the langinfo.xml of your language pack? When I look in the latest DE language pack, all time formats are “HH:mm:ss”. This should translate to “%H:%M:%S” as you say.

else if (StringUtils::CompareNoCase(id, "time") == 0)

You say that when your language is set to English, it works OK. There are multiple ‘English’ time formats depending upon the region selected. Exactly which ‘English’ locale are you using with your test? The format “%I:%M:%S %p” suggests an original format of “h:mm:ss xx”.

@b-jesch
Copy link
Author

b-jesch commented Oct 26, 2023

From the langinfo.xml:

<region name="Deutschland" locale="DE">
<dateshort>DD.MM.YYYY</dateshort>
<datelong>DDDD, D. MMMM YYYY</datelong>
<time symbolAM="" symbolPM="">HH:mm:ss</time>
<tempunit>C</tempunit>
<speedunit>kmh</speedunit>
<timezone>CEST</timezone>
</region>

All time formats are set to "regional", in case of English see screenshot.
Bildschirmfoto von 2023-10-26 09-16-26

The formatting of date described in the PR #22982 is not affected.

@DeltaMikeCharlie
Copy link
Contributor

Have you tried xbmc.getRegion('timeraw') to see if that matches your language file? It may give a hint for debugging.

@b-jesch
Copy link
Author

b-jesch commented Oct 26, 2023

Just tried, returns the same false scheme (%H:mm:ss) on a CoreElec 21.0beta1 compiled at 20.10.2023. Btw. the parameter 'timeraw' is not documented yet: https://xbmc.github.io/docs.kodi.tv/master/kodi-base/d6/db2/group__python__xbmc.html#ga04efad52a8903be517a8310db6a8505f

On a Linux (Ubuntu Focal) system with Kodi 21.0 alpha compiled at 04.05.2023 the scheme returns the correct value (%H:%M:%S), but timeraw returns an empty string.

@DeltaMikeCharlie
Copy link
Contributor

I thought that the issue sounded similar to something that I had seen before. I'm out of ideas. Sorry.

@mglae
Copy link
Contributor

mglae commented Oct 28, 2023

In case GttHub did not notify: fix is in #24009

@b-jesch
Copy link
Author

b-jesch commented Nov 1, 2023

Thanks for info. I will close this issue when the fix has merged.

@thexai thexai added the Resolution: Fixed issue was resolved by a code change label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Fixed issue was resolved by a code change Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants