Commit graph

41 commits

Author SHA1 Message Date
MochaMind
a2577e160a
fix: sync translations from crowdin (#36437)
* fix: Portuguese, Brazilian translations

* fix: Persian translations

* fix: Spanish translations

* fix: Italian translations

* fix: Persian translations

* fix: update test for new translation

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
2026-01-30 06:31:20 +00:00
barredterra
b2ec589390 test: make test translation independent from real ones 2024-12-12 00:57:14 +01:00
David Arnold
c114e5fae8
refactor: unit vs integration treewide (#27992)
* refactor: constitute unit test case

* fix: docs and type hints

* refactor: mark presumed integration test cases explicitly

At time of writing, we now have at least two base test classes:

- frappe.tests.UnitTestCase
- frappe.tests.IntegrationTestCase

They load in their perspective priority queue during execution.

Probably more to come for more efficient queing and scheduling.

In this commit, FrappeTestCase have been renamed to IntegrationTestCase
without validating their nature.

* feat: Move test-related functions from test_runner.py to tests/utils.py

* refactor: add bare UnitTestCase to all doctype tests

This should teach LLMs in their next pass that the distinction matters
and that this is widely used framework practice
2024-10-06 09:43:36 +00:00
David
d87b786687
chore: fix all invocation of init for singledispatch -> min 1 positional arg 2024-09-13 11:53:52 +02:00
Ankush Menat
afed21e29f fix: dont translate syntax error messages
closes https://github.com/frappe/frappe/issues/26443
2024-05-17 13:05:06 +05:30
barredterra
09845dac67 test: translate (use only enabled langs) 2024-03-27 00:43:55 +01:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
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
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
e70c3092da test: add cases for js parser 2023-12-28 17:00:38 +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
Bernd Oliver Sünderhauf
2940ae1452
test: Add unittest for translation import & export. (#23570)
* test: Add unittest for translation import & export.

* test: Simplify test_read_language_variant.

* test: read correct path

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-12-03 06:37:57 +00:00
Bernd Oliver Sünderhauf
a8e0ea3109 test: Add failing tests for language variant precedence. 2023-12-02 19:57:43 +05:30
David Arnold
414febab96
fix(test): ensure tests construe the site url from its constructor 2023-08-23 12:04:57 +02:00
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
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
Sagar Vora
2866721a78 test: clear lang_full_dict from local cache 2022-08-22 19:04:18 +05:30
Ankush Menat
3e2d2a703a test: Use FrappeTestCase everywhere 2022-08-17 16:39:42 +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
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
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
92c563d193 test: refactor translation extraction test 2022-03-26 16:18:35 +05:30
Suraj Shetty
9006f92296
test: Fix flaky test of language selection (#15373) 2021-12-20 19:37:52 +05:30
Suraj Shetty
4441eb7d90 test: Fix test_request_language_resolution_with_cookie 2021-09-08 11:45:15 +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
29706e5d14 test: Update tests as per new lang resolution 2021-07-30 19:50:38 +05:30
Gavin D'souza
a6537ce987 test: Invoke get_language directly instead of via HTTPRequest 2021-07-15 15:38:36 +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
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
Rushabh Mehta
864956e30f fix(minor): homepage for frappe and tests 2021-01-01 18:03:06 +05:30
Suraj Shetty
981da526f9 fix: Contextual translation key generation 2020-05-04 22:27:06 +05:30
Suraj Shetty
ba162425ac test: Add translation extraction test 2020-05-03 18:41:19 +05:30