Commit Graph

25 Commits

Author SHA1 Message Date
bastimeyer 5e6f03c3cd chore: add "B" rules to ruff config 2023-03-24 09:41:23 -07:00
bastimeyer 57fa6f80e8 chore: add "COM" rules to ruff config 2023-02-09 10:26:50 -08:00
bastimeyer faab9200c7 chore: add "I" and "TID" rules to ruff config 2023-02-09 10:26:50 -08:00
bastimeyer 66a75f9d60 utils.l10n: switch to locale.getlocale()
Replace `locale.getdefaultlocale()` with `locale.getlocale()`, as it's
deprecated since Python 3.11.

Also rewrite and add more tests.
2022-07-14 10:48:55 -07:00
bastimeyer 8fc178276e chore: fix import typing issues 2022-05-24 14:07:47 -07:00
bastimeyer feb1534fa0 utils: fix typing issues 2022-05-22 19:30:15 +02:00
bastimeyer aabd6af718 setup: drop iso-639/iso3166, default to pycountry
- drop iso-639 and iso3166 dependencies in favor of pycountry
- remove the `STREAMLINK_USE_PYCOUNTRY` env var switch from setup.py
- move dependencies list from setup.py to setup.cfg
- update utils.l10n and its tests
- update Windows installer config
- update docs
2021-11-14 11:42:36 -08:00
bastimeyer 5bc29b1c97 utils/l10n: fix langs without alpha_2 in pycountry 2021-01-27 09:46:44 -08:00
bastimeyer bf5d3efa6c chore: inherit from object implicitly 2020-11-27 16:04:45 +01:00
bastimeyer fcda5b6814 chore: remove u-strings 2020-10-31 18:04:08 +01:00
bastimeyer c94a810791 chore: remove is_py{2,3} compat checks 2020-10-19 17:28:47 +02:00
Billy2011 ee4f8371df
utils.l10n: use DEFAULT_LANGUAGE_CODE if locale lookup fails (#3055)
instead of using DEFAULT_LANGUAGE.

This will prevent the LookupError from being raised unnecessarily
by the Localization._parse_locale_code call afterwards.
2020-10-17 12:26:59 +02:00
Sebastian Meyer 3c082049e9
utils.l10n: fix pycountry language lookup (#3057) 2020-07-04 18:53:59 +02:00
bastimeyer c0cf64a97b flake8: E741
E741 ambiguous variable name '...'
2020-02-23 09:53:55 +01:00
bastimeyer ca0ddd8e7f flake8: W504
W504 line break after binary operator
2020-02-23 09:53:55 +01:00
back-to 86214d93eb
debug: Added Session Language code as a debug message
It will show this message when Localization is called by muxed hls or 
dash streams.

```
$ streamlink ... --locale ru_RU
...
[plugin.dash][debug] Parsing MPD URL: ...
[utils.l10n][debug] Language code: ru_RU
```

or your local system code

```
$ streamlink ...
...
[plugin.dash][debug] Parsing MPD URL: ...
[utils.l10n][debug] Language code: xx_XX
```
2018-07-12 15:04:23 +02:00
hicrop 55db9e0f1e PEP8 (#1427)
* E265 - Fix spacing after comment hash for block comments.

* W293 - Remove trailing whitespace on blank line.

* E305 - Add missing 2 blank lines after end of function or class.

* E123 - Align closing bracket to match opening bracket.

* E202 - Remove extraneous whitespace before bracket.

* Remaining fixes.
2018-01-15 18:49:52 -08:00
beardypig 0dad9091ad utils.l10n: use default locale if the system returns an invalid locale 2017-03-21 09:46:44 +00:00
beardypig a084febeba utils.l10n: fix for some locales without an official name in pycountry 2017-03-02 12:10:35 +00:00
beardypig 1e7232091b utils.l10n: fix bug in iso3166 country lookup
The `pycountry` vs. `iso639+iso3166` l10n tests were broken so that the
only the `pycountry` tests were being run. This has now been fixed, which
uncovered a bug in the `iso3166` country lookup.
2017-02-10 16:11:56 +00:00
beardypig 67d7dad2c6 utils.l10n: default to en_US when an invalid locale is set 2017-02-06 10:06:57 +00:00
beardypig 38ffa5694e utils.l10n: add Country/Language classes, use pycountry is the iso modules are not available 2017-02-03 18:47:17 +00:00
beardypig a5375dd8c9 localization: invalid language/country codes are always inequivalent 2017-01-26 11:03:46 +00:00
beardypig e913fb036e localization: search for language codes in part2t+part2b+part3 2017-01-26 10:56:32 +00:00
beardypig 938662fdff add a general locale setting which can be used by plugins
plugins.crunchyroll: updated to use global locale setting
2017-01-25 14:12:38 +00:00