Commit graph

233 commits

Author SHA1 Message Date
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
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
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
2022-07-01 11:51:05 +05:30
Gavin D'souza
5f0555d982 fix: Translate strings in public folders too 2022-06-29 11:58:53 +05:30
Danny
47483f833f
feat(translations-cli): Fetch translations for a particular app (#17276)
* translataions for particular app 

get-untranslated/update-translations string for particular app frappe#17268 (feature request)

* fix: linting, making stuff DRY-er

Co-authored-by: gavin <gavin18d@gmail.com>
2022-06-24 17:04:49 +05:30
Gavin D'souza
b696fa6da5 perf: Pre-compile and re-use regexp pattern
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
2022-06-08 14:07:38 +05:30
Sagar Vora
97df77f954
perf(translation): improve if condition to return all values except None (#16953) 2022-05-23 12:58:42 +05:30
Ankush Menat
d90d6536ef perf: dont rebuild same translation dict 2022-05-22 22:54:23 +05:30
Ankush Menat
26b54221ea test: verify ALL translation file syntax 2022-05-13 16:12:40 +05:30
Ankush Menat
55def8b718 fix: recursion error in translations
If bad translations is found then while `msgprint` it attempts to load
translation again because of its arg `title = _("Message")`
2022-05-13 16:12:40 +05:30
Ankush Menat
b714dbb190
fix: dont throw error for a bad translation (#16769) 2022-04-27 10:49:56 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Ankush Menat
29ca4d7aaa feat: allow splitting _() function call on multiple lines 2022-03-26 16:18:35 +05:30
Ankush Menat
cf69b7f084 fix: only match 1 python context string at most 2022-03-26 16:18:35 +05:30
Ankush Menat
6fc3c30dc1 refactor: make translate regex readable 2022-03-26 16:18:33 +05:30
barredterra
8a4f316ec5 refactor: remove useless pass, log error 2022-03-20 02:35:35 +01:00
Suraj Shetty
4c2f14f824
Merge pull request #16079 from surajshetty3416/fix-translation-for-included-files 2022-02-22 19:05:01 +05:30
Suraj Shetty
eaf8327e0d fix: Use correct path of built assets
- Get path from bundled_assets
2022-02-22 18:43:16 +05:30
barredterra
745297a49d refactor: a not in b
Search: if not ([\w\d]*?) in ([\w\d]*?)
Replace: if $1 not in $2
2022-02-21 19:54:34 +01:00
barredterra
b1383df15a refactor: use is None instead of == None 2022-01-17 10:37:51 +01:00
Aradhya
9ccf467acb fix: fixed no order arg in converted queries 2021-11-23 13:30:42 +05:30
Aradhya
ed7b3f54a7 refactor: converted more queries 2021-11-20 15:02:22 +05:30
Aradhya
fcd480b2a8 refactor: Converted queries in translate 2021-11-18 09:56:41 +05:30
Aradhya-Tripathi
92ad93c9d7 fix: sider issues 2021-10-26 18:41:27 +05:30
Aradhya-Tripathi
56dfae64f3 fix: converted dependent queries 2021-10-26 18:32:50 +05:30
Aradhya-Tripathi
a76f64bbaf fix: fixing query in translate.py 2021-10-26 17:51:37 +05:30
Aradhya-Tripathi
012edfe090 refactor: made style changes & fixed query conversions 2021-10-22 01:15:46 +05:30
Aradhya-Tripathi
0cce6e2af8 fix: fixed erroneous queries in translate 2021-10-16 10:50:57 +05:30
Aradhya-Tripathi
668051cfe9 refactor: refactored query using frappe.get_all 2021-10-14 23:05:59 +05:30
Aradhya-Tripathi
e01d97b8df refactor: replacing queries with frappe ORM 2021-10-14 01:16:46 +05:30
Aradhya-Tripathi
e0a3e4efe3 refactor: converted queries in share & translate 2021-10-13 15:13:13 +05:30
mergify[bot]
f4d260de0d
fix: Problems while using translations via Globe Symbol (#14128)
Co-authored-by: Vama Mehta <vama.mehta@inqubit.in>
(cherry picked from commit 40f2e915918860ade1e514c8b0bb4cf1bb6d0b2b)

Co-authored-by: vama <vamagithub@gmail.com>
2021-09-06 14:16:27 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
450d4e489b refactor(lang): frappe.translate.get_language
User.language should be given higher priority in terms of
authenticated user since they chose it. Even higher than the
browser they're using...even if the system locales aren't set
properly and browser isn't configured properly
2021-07-30 18:59:57 +05:30
Gavin D'souza
421220a872 test: Added tests for frappe.translate.get_language 2021-07-15 01:04:04 +05:30
Gavin D'souza
4959dd02f1 refactor(minor): frappe.translate.get_messages_from_file
* Don't re-define frappe util - get_bench_path
* Add Python types
* Style changes
2021-07-14 20:40:43 +05:30
Gavin D'souza
8faf2fd759 refactor(minor): frappe.translate module
* Remove unset limit for lru cache in get_parent_language
* Simplify get_user_lang and add relevant comment
2021-07-14 19:33:48 +05:30