- translations are loaded in apps.txt order this doesnt make much sense.
- translations are loaded from apps which aren't even installed, again
doesn't make sense.
Breaking but necessary change.
* Refactor type checks defined in APIs
* Remove dead/deprecated kwargs usages
* Added appropriate hints to APIs and consecutive utils defined in the following modules:
- frappe.realtime
- frappe.translate
- frappe.utils.global_search
- frappe.www.third_party_apps
- frappe.www.search
- frappe.www.printview
_("string") outside of function/methods don't make any sense cause they
are initialized the moment module is imported. This is already checked
in CI yet people make this mistake.
Ignore and refuse to translate in those cases.
* refactor: rename poorly named functions
* refactor: getting translation from apps
- use generator
- use sane name for cache key
- avoid manual handling of frappe.local state just use cache() interface
* feat: Select only enabled languages for "language selector", and use System Settings lang as default one
[skip ci]
(cherry picked from commit e5b8a47835d22b7834865324d30d796bb3031dd5)
Co-authored-by: Development for People <47140294+developmentforpeople@users.noreply.github.com>
RIP my cool handwritten AST code :'(
Few things to note:
1. Publicly documented APIs, they don't support capturing kwargs.
2. We can't use documented "lower level" APIs, we need to go _even lower_.
* chore: warn about missing scheduler / doc events
* fix: pass list instead of filter
filter can only be iterated upon once
* refactor: many typehints in __init__.py
refactor: clean up code to py39+ supported syntax
- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes
Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
Converted all possible usages of re.* that weren't compiling the regex
separately and re-using it. Separated out the compiled patterns as
global variables. Repetitive patterns could be made DRY-er.
Would be nicer to have all regexes in a single module so that we could
re-use better, keep track of outdated, and keep checks for possible
reDos' etc