Commit Graph

52 Commits

Author SHA1 Message Date
Campbell Barton 432bfbf7a3 Cleanup: pep8 2021-07-06 12:05:27 +10:00
Campbell Barton 013fc69ea8 Cleanup: unused argument & variable warnings 2021-06-15 10:50:43 +10:00
Campbell Barton 37793b90be Cleanup: unused imports 2021-03-06 19:26:18 +11:00
Campbell Barton 8cc951d2ae Cleanup: trailing space 2020-12-11 15:32:14 +11:00
Bastien Montagne b3306cf669 i18n utils: Add a helper to list and match po files with languages codes.
This code was previously done in the add-on, but we'll need it for the
CLI tool as well, so now it is a utils generator instead.
2020-12-04 15:14:16 +01:00
Bastien Montagne 06ae2e3a60 i18n utils : Reduce dependency to Blender bpy API, step 2.
Remove some top imports of bpy, only import it in a few specific
functions that only make sense when used whithin Blender anyway.
2020-12-04 15:14:16 +01:00
Bastien Montagne 7bd8b8cdac i18n utils: reduce dependency to Blender bpy API, step 1.
This involves re-implementing some of Blender-defined helpers in utils,
we keep debug code to ensure those are still matching on
behavior/results sides.

This will allow to get more i18n tools independent from blender
executable.
2020-12-04 15:14:16 +01:00
Campbell Barton 41d2d6da0c Cleanup: pep8 (indentation, spacing, long lines) 2020-10-02 11:59:16 +10:00
Bastien Montagne c9ff8b5cd6 Various fixes, cleanup and improvements to i18n module.
* Remove multi-processing in messages class update, was no giving much
  speedup if any at all.
* Remove some debug prints.
* Make messages class pickleable.

* Filter better actual setting values from Settings class.
* Make settings pickleable.

All this will allow to use multi-processing in the i18n addon itself.
2020-05-05 18:08:40 +02:00
Bastien Montagne 9607e54985 Fix T74959: Need to be explicit about UTF8 encoding in py.
Because some OSs are still using old 8bits specific encodings... Angry
eye @windows...
2020-03-20 20:52:52 +01:00
Campbell Barton 5a541cfcec Cleanup: resolve static analyzer warnings in bl_i18n_utils
Reported in T73504
2020-01-30 11:48:26 +11:00
Campbell Barton 2790740813 Cleanup: spelling 2019-08-17 00:57:05 +10:00
Bastien Montagne 4b37abd61f Cleanup a bit i18n message extraction code. 2019-08-01 12:52:52 +02:00
Brecht Van Lommel 604fdb6e85 Spelling fixes in comments and descriptions, patch by luzpaz
Differential Revision: https://developer.blender.org/D3744
2019-07-31 14:27:35 +02:00
Campbell Barton bbe98b18fb Cleanup: use preferences prefix for Python operators 2019-03-02 00:23:42 +11:00
Bastien Montagne 59b530ca18 Fix and workaround for i18n messages extraction code. 2018-12-23 22:03:43 +01:00
Campbell Barton 63fcbfc3a7 RNA: naming, user-preferences -> preferences 2018-12-21 12:55:02 +11:00
Campbell Barton 254067106e PyAPI: remove operator methods that leak memory 2018-09-13 20:10:56 +10:00
Brecht Van Lommel 4da2acae3a Spelling fixes in comments and descriptions, patch by luzpaz.
Differential Revision: https://developer.blender.org/D3668
2018-09-03 16:55:01 +02:00
Campbell Barton 4b373ed086 Cleanup: pep8 2018-07-07 08:48:35 +02:00
Bastien Montagne 02a496c61c Translations utils: add needed bits to update git repo together with svn trunk. 2015-06-13 11:42:54 +02:00
Campbell Barton f5a471ef86 Python: avoid mutable default param values
D1328 by @yedpodtrzitko
2015-05-31 15:58:58 +10:00
Campbell Barton e17c6f79a5 cleanup: py imports 2015-01-28 16:50:51 +11:00
Campbell Barton 0e0e528ea4 Cleanup: pep8 2014-09-17 18:36:17 +10:00
Campbell Barton aea00c7a81 Code cleanup: style 2014-02-13 08:52:12 +11:00
Bastien Montagne 84daa57188 Update i18n tools for new build_hash... 2013-11-04 18:26:56 +00:00
Bastien Montagne 4edffbf54f More complete handling of printf formatting in msgid/msgstr checks.
(That commit, r60813, should never have been done to 2.69 branch, will revert it there, sorry :/ ).
2013-10-19 14:28:32 +00:00
Bastien Montagne 6e9c3a9abf i18n utils: check not only that the number of printf markers are the same in msgid and msgstr, but also that they are of the same type and order. Sorry, should have done that from the beginning... :/
This should prevent any bug like [#37095] Timeline crash when chose any keying set then press keyframe-insert, to appear again.
2013-10-17 06:52:26 +00:00
Lukas Toenne 771906bc09 Fix for #36387, User Preferences "Addons" panel bogs down the whole interface.
The addons panel draw function calls addon_utils.modules() which in turn retrieves a list of fake modules from the script paths every time. This can become costly when network paths are included for
addons. Solution is to put the scanning process into a dedicated "refresh" function and disable it in frequently called draw and filter functions, i.e. in these cases the cached addons_fake_modules list
will be used instead.

Note that this may lead to invalid addon lists if script paths are changed (which is not working 100% without restart anyway according to Campbell). For this there is now a "Refresh" operator button in
the addons preferences. If necessary and feasible such forced refreshes can be added later too.
2013-08-28 06:36:54 +00:00
Bastien Montagne b0b634adeb Do not report formatting mismatch between org and translation when message is fuzzy (but "fix" it anyway if asked so). 2013-04-29 18:22:22 +00:00
Bastien Montagne fba67abf7a Restore usage of difflib's quick_ratio()... Don't actually know what happens here, my tests with timeit showed it much slower than ratio(), but real-life says the contrary... 2013-04-19 16:23:02 +00:00
Bastien Montagne 01ffbab8f5 Some i18n tools fixes (I'm ashamed...), and merge func for I18nMessages objects. 2013-04-18 15:26:22 +00:00
Bastien Montagne 4587ecd45b More i18n tools tweaks:
* Remove difflib's quick_ratio() call, from quick tests looks it is four times slower than ratio(), and yet it gives the same results...
* Moved code to find all po's in a dir into its own func (will be used by i18n addon tools too).
2013-04-18 11:09:25 +00:00
Bastien Montagne 0e4b092c2d More fixes for addon i18n messages management. 2013-04-12 12:19:50 +00:00
Bastien Montagne 6382f6bedd Various edits preparing addons' translations tools (not everything yet functionnal/tested, though).
Also workaround a nasty bug, where unregistered py classes remain listed in relevant __subclasses__() calls, which would lead to crash with python addons i18n tools (main translation was not affected, as messages extracting tools are executed in a brand new "factory startup" Blender ;) ).
2013-04-09 08:56:35 +00:00
Campbell Barton 8e3d590b76 code cleanup: python/pep8 and double-promotion warnings. 2013-03-28 19:33:14 +00:00
Bastien Montagne e45da6f40a Small changes/additions to i18n tools. 2013-03-19 15:49:53 +00:00
Bastien Montagne fbbbb90af3 Some renaming/cleanup in i18n tools. 2013-03-19 08:33:24 +00:00
Bastien Montagne 462e4bee87 More tweaks (gaining about ten seconds for each po in update branches process!). 2013-03-01 14:28:38 +00:00
Bastien Montagne 095062f0c5 Tame that stupid py code not to eat existing fuzzies in po’s when updating from POT file! 2013-02-25 16:06:59 +00:00
Bastien Montagne 2c348d003e Big i18n tools update, I/II.
Notes:
* Everything is still a bit raw and sometimes hackish.
* Not every feature implemented yet.
* A bunch of cleanup is still needed.
* Doc needs to be updated too!
2013-02-24 08:50:55 +00:00
Bastien Montagne f6624aaacd Gah, forgot some ugly print... 2013-02-13 21:56:12 +00:00
Bastien Montagne f2d9fc7e25 Update to how similar messages matching is handled when updating po files from pot one (gain something like 20% in heavy update situations, and save a nice bunch of memory!). 2013-02-12 17:32:54 +00:00
Bastien Montagne 97a5cd92bc Some optimization (their is much more possible here, but it will have to wait for complete refactor I’m working on currently). 2013-01-29 08:34:26 +00:00
Bastien Montagne 819a75113e Some fixes:
* handle nicely multiple empty lines in po files (still have to figure out why po writer sometime output two lines instead of one!)
* fix rtl processing!
2013-01-14 21:41:21 +00:00
Bastien Montagne 884d7caa24 Minor updates:
*Made branches' po update multi-process!
*0.8 looks a bit too much a "similarity cutoff" value for messages, changed to 0.75.
2013-01-13 17:43:04 +00:00
Bastien Montagne 55e3912f25 Big refactor of bl_i18n_utils, switching to an object-based model. Still a bit wip.
Notes:
* Most tools here have been updated, only a few (unused :p ) features should be missing. But some updates are rough for now, and performances are globally worse currently, will address this later (this is only really noticeable when you work over the whole repo, anyway ;) ).
* This update breaks "edit translations" addon, will fix it later, once core (i.e. this module) is considered stable again!
2013-01-12 16:49:06 +00:00
Bastien Montagne 7b8dc4be0d Few minor fixes to i18n tools (mostly use ordered dicts too for "xgettexted" messages...). 2012-10-14 14:18:30 +00:00
Campbell Barton 8a51d235e6 pep8 cleanup 2012-09-26 21:19:51 +00:00
Campbell Barton 2553cdf195 style cleanup 2012-07-29 12:07:06 +00:00