Commit graph

204 commits

Author SHA1 Message Date
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
Gavin D'souza
e8d50b9d3c chore: Add types for frappe.translate module
*only for recently modified functions
2021-07-14 19:32:30 +05:30
Gavin D'souza
76ec9e44e4 refactor: Rename guess_language as get_language
Guess suggests there's some AI involvement. The get_language function
has a defined priority. It is deterministic, hence teh name change.
2021-07-14 12:21:12 +05:30
Gavin D'souza
c47cbfd2ef refactor: Set Language in HTTPHeader
Order of priority for setting language:
1. Form Dict => _lang
2. Cookie => preferred_language
3. Request Header => Accept-Language
4. User document => language
5. System Settings => language

Cookie is placed at #2 since the language picker in the navbar depends
on it. And the Accept-Language header sends values based on the client's locales.

---

Form Dict _lang now accepts language codes too. Previously, language
names were used...for whatever reason.
2021-07-14 12:21:12 +05:30
Fahim Ali Zain
f5bd21cf46 fix: preferred_language cookie support for all users 2021-07-14 12:21:12 +05:30
Gavin D'souza
c489846547 Merge branch 'develop' into unnecessary_comprehensions 2021-06-11 19:30:23 +05:30
Gavin D'souza
793b5638d3 style: Fix E201, E202, E401, E701
reported by sider: https://sider.review/gh/repos/1864194/pulls/13344?statuses#issues
2021-05-27 12:48:01 +05:30
Gavin D'souza
f6b215938a fix: Use raw string to avoid invalid sequence errors
Escaped when proven easier
2021-05-26 19:30:08 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Joseph Marie Alba
e8d79030f7
fix: Python 3 issue on re (#13230)
Python 3 interprets string literals as Unicode strings, and therefore \s and \g are treated as escaped Unicode characters.

Fix: Declare RegEx pattern as a raw string instead by prepending r
2021-05-21 13:14:33 +05:30
Ankush Menat
4754ab71d1
perf(minor): remove unnecessary comprehensions
- remove several unnecessary comprehensions from functions that accept a generator.
- Using `[x for x in iter]` causes a list to be built first then passed to the outer function.
- `any` and `all` can take generator instead. This makes memory usage O(1) and actually makes these functions short-circuiting. E.g. if the first condition fails then `all` will immediately return false instead of evaluating all the entries.
- `sum`, `min`, `max` => memory usage become O(1)
- `list`, `set`, `.join()` => roughly halves memory usage, as list is not required to be built.
- lastly, it's two fewer characters to read/think about.
2021-05-12 20:38:18 +05:30
Raffael Meyer
67ceab88ff
fix: translations (#12942)
* fix: get_messages_from_include_files
* feat: include labels of navbar items
* refactor: strip -> lstrip

Co-authored-by: gavin <gavin18d@gmail.com>
2021-05-11 12:28:15 +05:30
Sagar Vora
ac9fe71733 fix(setup): do not show messsage when exception is handled 2021-05-03 17:14:45 +05:30
Suraj Shetty
ce10753e91
Merge pull request #12944 from alyf-de/report_column_context 2021-05-03 13:47:46 +05:30
barredterra
cbf0459b21 Merge branch 'develop' into translate_report_column_labels 2021-04-29 12:01:34 +02:00
Suraj Shetty
32d3f1f099
fix: build-message-files command (#12950) 2021-04-22 01:12:38 +05:30
Suraj Shetty
6225f9b35e
fix(query): Use single quotes for string constant (#12948) 2021-04-22 00:41:13 +05:30
barredterra
6250c4ac9d fix: add context to filter columns 2021-04-21 19:46:33 +02:00
barredterra
bf4a73c3d4 fix: translate report filter labels 2021-04-21 18:28:02 +02:00
barredterra
f84aee8abe fix: translate report column labels 2021-04-21 18:16:59 +02:00
Faris Ansari
1ce0b89887
fix: Ignore non utf-8 files for translation scan (#12935) 2021-04-21 12:15:54 +05:30
Suraj Shetty
1600d85279
fix: Typo in get_all_language_with_name (#12902) 2021-04-19 14:15:30 +05:30
thebachy1
a373c00abd fix: Load server translations in boot 2021-04-14 12:39:46 -05:00
Suraj Shetty
df0578d248 feat: Show language switcher for guest users on navbar 2021-04-07 18:18:15 +05:30
Aditya Hase
a708ba4b94
perf: Remove Jinja from import tree 2021-02-20 21:18:01 +05:30
Suraj Shetty
7a80a321f5 fix: Rename Desk Shortcut to Workspace Shortcut 2021-02-01 12:01:07 +05:30
Fisher Yu
2b01fb091f
fix: Translation related issues (#11932)
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2021-02-01 11:06:49 +05:30
Tim Gates
f54ec2ba11
docs: fix simple typo, transaltion -> translation (#12136)
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2021-01-05 17:18:09 +05:30
Javier Lopez
7c814e7a7f
fix: csv file opening options
This is in line with the api changes 
1. http://python3porting.com/problems.html#csv-api-changes
2. https://docs.python.org/3/library/csv.html#id3
2020-10-26 16:26:49 -05:00
Javier López
ec5851abf7 fix: wrong type when writing with csv writer
Unlike the get_untranslated function, in which the file is opened and
written with the `write()` function, here the `csv.writer()` is used,
causing errors when writing encoded strings. Therefore we remove the
encoding step (The csv writer will take care of it) and we also not open
the file with binary mode.
2020-10-26 15:42:38 -05:00