Commit graph

268 commits

Author SHA1 Message Date
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Akhil Narang
f19c25ec42
Merge pull request #24432 from blaggacao/chore/cleanup-frappe-connect-2
chore: cleanup frappe connect II/II
2024-02-02 16:53:19 +05:30
Ankush Menat
aad0c19f3a
fix: lazy translate circular imports (#24672)
* Revert "fix: remove _lt from frappe.model.std_fields (#24662)"

This reverts commit 833d108614.

* fix: circular import
2024-02-01 12:27:25 +00:00
David Arnold
c57bc94ead
chore: cleanup frappe.connect invocations 2024-01-24 11:56:24 +01:00
barredterra
368283769f refactor: move extract_messages_from_code to a separate utils file
In order to avoid circular imports.
2024-01-19 16:16:38 +01:00
Ankush Menat
b3eaec4347
fix: misc (#24303)
* fix(DX): improve logging in various places

* fix(ux): misc RQ worker and job fixes
2024-01-13 10:54:38 +05:30
Ankush Menat
98b62e8220 fix: add _lt to extractors 2024-01-10 21:47:55 +05:30
Ankush Menat
1f6201b4af feat: lazy global translated strings 2024-01-10 21:28:01 +05:30
Ankush Menat
f246f37762 fix: language variants support 2024-01-10 18:27:57 +05:30
barredterra
a53e819022 fix: move extract_javascript to extractors folder and use it
instead of babels js extractor
2023-12-28 17:00:46 +01:00
barredterra
e1140a22b8 fix: don't presume english as source language
Note: If we DO want this, it should happen at a higher level.
2023-12-26 23:18:07 +01:00
barredterra
483fa15c8f fix: clear translation cache
- Cache was not getting cleared, since it's user-specific
- Remove unused implementation from gettext
2023-12-26 23:17:31 +01:00
barredterra
3a76fb2253 feat: support CSV and gettext at the same time 2023-12-26 19:13:10 +01:00
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
barredterra
c35476256f refactor: simplify conditional logic
Command: `sourcery review --fix --enable de-morgan .`
2023-12-05 11:14:41 +01:00
HarryPaulo
4203c3b13d fix: load languages that have capital letters 2023-11-20 22:31:12 -03:00
barredterra
e3ff2456ef chore: remove unused method 2023-11-06 19:46:34 +01:00
Raffael Meyer
f0155674a5
refactor!: remove redundant sending of translations (#22962)
* chore!: remove redundant translation

* refactor!: remove "get_translated_dict" hook

Instead, include the results from
`frappe.geo.country_info.get_translated_dict` in `get_all_translations`.

* test: money_in_words uses translated currency

... and now we have translations.

* Revert "test: money_in_words uses translated currency"

This reverts commit e07d594ac1ce4b120c0fceb5d23377cb981fe820.

* refactor!: stop translating timezone and currency

* refactor: rename `get_translated_dict`

... to `get_translated_countries`
2023-11-02 20:04:14 +05:30
barredterra
41b0308951 refactor: use higher level get_app_path
It's just nicer to read; less mental load.
2023-08-21 17:15:45 +02:00
barredterra
88c8baa9ee refactor: for append to extend, merge list extend
Replace a for append loop with list extend.
Create the list with values instead of creating
an empty list and extending it with another list.
2023-08-09 13:25:39 +02:00
barredterra
b553ed98d8 refactor: inline immediately returned variable
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
Sagar Vora
d2becc7f1d fix: no API call required to set cookie in browser 2023-07-22 17:54:41 +05:30
Ankush Menat
c6419f52e2 perf: Move babel import to extract function
This is never used in production.

[skip ci]
2023-06-23 14:13:53 +05:30
Anand Baburajan
38960f4219
feat: migrate translations command (#21362)
* feat: migrate translations command

* chore: formatting
2023-06-19 18:19:07 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
0b8b829483 perf: dont cache intermediate translation files
Just caching final files for each language is enough, duplicating
doesn't help much.
2023-04-11 12:10:49 +05:30
Ankush Menat
361e44de1d fix(translations)!: load translation in installed order
- 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.
2023-04-11 12:10:45 +05:30
Gavin D'souza
d357af1533 refactor: Add a maxsplit limit to string splits 2023-01-24 19:22:51 +05:30
Ankush Menat
1b1e4de35e
chore!: dead code (#19551)
This was added for some very old patch code.

[skip ci]
2023-01-10 18:53:08 +05:30
Ankush Menat
e00023deb1 refactor: replace bad usage of db.set_value 2023-01-04 11:13:53 +05:30
Gavin D'souza
d3250f6504 refactor(whitelisted): Add typing hints to APIs
* 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
2022-12-15 13:47:05 +05:30
barredterra
67ede5d533 feat: add parameters language and letter_head to download_pdf 2022-12-14 13:59:46 +01:00
Ankush Menat
a1a296ac75
fix: ignore global translations (#18733)
_("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.
2022-11-03 03:00:03 +05:30
Ankush Menat
3ddac5fe92
refactor: accurate translation caching (#18595)
* 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
2022-10-27 16:28:02 +05:30
Himanshu
192aa7a9ab
chore: linter fixes 2022-08-09 11:53:21 +01:00
Himanshu
44c2a2e309
Merge branch 'develop' into merge_translated_doctypes 2022-08-09 11:50:32 +01:00
mergify[bot]
cde6755aff
feat: Multilanguage sites: language selector only will show "enabled" languages and language default always will be System default (#17745) (#17766)
* 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>
2022-08-09 14:57:48 +05:30
Himanshu
b6281ffef6
chore: linter fixes 2022-08-09 09:49:21 +01:00
hrwx
b01929405d refactor: translatable doctypes 2022-08-05 21:38:10 +01:00
Ankush Menat
7452ac5d37
chore: correct default arg for extract_javascript
Tuples need extra comma to make sure it's not treated as string. 

[skip ci]

Co-authored-by: Sagar Vora <sagar@resilient.tech>
2022-08-04 15:52:32 +05:30
Ankush Menat
ec8f20c097 fix: send all messages on boot instead of scanning
close https://github.com/frappe/frappe/issues/17684
2022-08-04 15:33:03 +05:30
Ankush Menat
2d7fc1825f refactor: simplify get_messages_from_file 2022-08-04 15:33:03 +05:30
Ankush Menat
da872a0edf feat: modified parser for frappe JS translate syntax 2022-08-04 15:33:02 +05:30
Ankush Menat
cd53466b6a feat: JS extractor and custom JS parser 2022-08-04 15:19:56 +05:30
Ankush Menat
1425842ef0 refactor: extract python translations using babel
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_.
2022-08-04 15:19:55 +05:30
Ankush Menat
ea836a824a feat: use AST to extract translation sources 2022-08-04 15:19:55 +05:30
Ankush Menat
0cb4da1195 fix: ignore built assets in translation 2022-08-04 15:19:55 +05:30
Ankush Menat
a1eaefefda refactor: simplfiy translate pattern
\s already includes \n
2022-08-04 14:50:24 +05:30
Ankush Menat
9a5d11234c
fix: validate scheduler, hook method names (#17400)
* 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
2022-07-04 19:29:16 +05:30