Commit Graph

81 Commits

Author SHA1 Message Date
Valentin Lorentz
93370b6f0e utils: Rewrite i18n initialization
The previous implementation was messy and needlessly complicated

This simplifies the logic and removes hackiness by making utils/str.py
handle internationalization logic itself, instead of bending over
backwards to load logic from the parent package at import time.
2022-06-17 00:05:51 +02:00
Valentin Lorentz
32198d42c2 i18n: Skip fuzzy strings
The German translation currently has at least one fuzzy string
with a missing %s; and several translations are completely wrong.
2022-04-27 22:15:43 +02:00
Valentin Lorentz
63eb6672ea Revert generic 'The Limnoria Contributors' in copyright notices
This commit reverts db7ef3f025
(though it keeps the year updates)

After discussion with several people, it seems better to mention
copyright owners explicitly. eg. https://reuse.software/faq/#vcs-copyright
explains the issue of using VCSs to track copyright.

As db7ef3f025 only replaced mentions
of my name with 'The Limnoria Contributors', this commit only needs
to undo that + add one person who contributed to setup.py.
2021-10-17 09:57:55 +02:00
Valentin Lorentz
db7ef3f025 all: Add generic 'The Limnoria Contributors' to copyright notices.
No need to bother with details (that are all outdated / out of sync
anyway), just look up the git history.
2021-08-01 21:54:49 +02:00
Valentin Lorentz
a1ee580d08 Make getLocaleFromRegistryCache reload existing locales.
The core locale is loaded before this function is called, so it needs to
reload it for non-en locales to be loaded.
2019-11-24 12:59:38 +01:00
Valentin Lorentz
0828b207be Add fallback if getting supybot.language from registry cache failed. 2019-11-24 12:46:10 +01:00
Valentin Lorentz
423a38770b Get locale name on startup from registry cache instead of parsing config file.
Parsing the config file needlessly requires an extra read of it,
and is brittle (extra spaces, etc.)
It was especially broken as there was a newline character
at the end of currentLocale, which made everything fail
shamefully.
2019-11-24 12:04:21 +01:00
Valentin Lorentz
c260a76e06 Add fallback for interpreters which do not support __slots__ for str subclasses.
Affects CPython 2.x, but neither CPython 3.x or Pypy.

Incompatibility introduced in 38e7589ff3.
2016-02-20 13:35:40 +01:00
Valentin Lorentz
38e7589ff3 Make i18n.InternationalizeString use less memory. 2016-02-20 09:51:24 +01:00
Valentin Lorentz
be118c3338 Remove use of fix_dict fixer. 2015-08-08 23:08:49 +02:00
Valentin Lorentz
4470805b5f core: Remove useless imports. 2015-03-03 09:02:29 +01:00
c675654b82 src/i18n.py: have languages in alphabetical order
It's probably not so important, but I don't like them being in any
strange random order. Of course having English first would make sense as
it's the default, but I still prefer alphabetical order.
2015-02-08 09:44:13 +02:00
James Lu
5e4501d7d2 i18n.py: mention 'en' as supported lang & quote the language codes for less ambiguity.
Ref #1046.
2015-02-06 15:40:44 -08:00
544befd2d0 src/i18n.py: mention supported languages
Closes #1046

I used Admin for sources of what languages are supported as it's usually
recommended to start translating from there (first plugins, then core).
2015-02-06 11:58:24 +02:00
Valentin Lorentz
aad0f0c88c i18n: Don't strip spaces at the end of translated strings. Closes GH-750. 2014-06-19 10:28:08 +00:00
Valentin Lorentz
303c00db1e Fix previous commit. 2014-05-31 15:23:27 +02:00
Valentin Lorentz
bd638ce350 i18n: Cleaner code and potential bug fix of multi-line translations. 2014-05-31 14:56:28 +02:00
Valentin Lorentz
c6cb4fa394 i18n: Prevent untranslated strings from having empty translations 2014-03-10 16:26:26 +01:00
Valentin Lorentz
5d301b653f Merge remote-tracking branch 'origin/speed-up-2to3' into testing
Conflicts:
	locales/fr.po
	plugins/Misc/plugin.py
	sandbox/check_trans.py
	src/i18n.py
2014-02-02 22:28:19 +01:00
Valentin Lorentz
4fe74ed397 Merge branch 'aka-sqlite3' into speed-up-2to3 2014-02-02 22:15:43 +01:00
Valentin Lorentz
aea86d432f Fix previous commit. 2014-01-26 21:34:24 +01:00
Valentin Lorentz
eaed281de7 Fix compatibility with Python 2.6 (does not support the set syntax). 2014-01-26 21:13:06 +01:00
Valentin Lorentz
121991eff9 Fix case of i18n.InternationalizedFunction. 2014-01-26 20:45:28 +01:00
Valentin Lorentz
9b365d1ed8 Fix case of i18n.InternationalizedString. 2014-01-26 20:45:28 +01:00
Valentin Lorentz
f3e292d518 Fix memory leak in i18n by using weak references to plugin classes and methods. 2014-01-26 20:45:28 +01:00
Valentin Lorentz
489ec1b065 i18n: Move the pot files parsing to a separate function. 2014-01-26 20:45:27 +01:00
Valentin Lorentz
6a8b7889ea Remove unnecessary call to i18n.reloadLocalesIfRequired. 2014-01-26 20:45:27 +01:00
Valentin Lorentz
8d1201aa43 Fix case of i18n.InternationalizedFunction. 2014-01-22 11:04:08 +01:00
Valentin Lorentz
5c08281543 Fix case of i18n.InternationalizedString. 2014-01-22 10:54:40 +01:00
Valentin Lorentz
974a64de44 Fix memory leak in i18n by using weak references to plugin classes and methods. 2014-01-22 10:51:01 +01:00
Valentin Lorentz
1874440cc8 i18n: Move the pot files parsing to a separate function. 2014-01-21 22:39:48 +01:00
Valentin Lorentz
35c7b52e14 Remove unnecessary call to i18n.reloadLocalesIfRequired. 2014-01-21 16:36:45 +01:00
Valentin Lorentz
4652c9ce51 Start accelerating the 2to3 step (remove fix_apply, fix_buffer, fix_callable, fix_exec, fix_execfile, fix_exitfunc, fix_filter, fix_funcattrs, fix_future, fix_getcwdu, and fix_has_key). 2014-01-20 14:49:47 +01:00
Valentin Lorentz
4a9d3ccd3e Fix previous merge. 2014-01-03 17:15:32 +00:00
nyuszika7h
0e480b4e52 Fix file descriptor leaks 2014-01-03 17:44:01 +01:00
Valentin Lorentz
be04677995 Fix typo in a comment. 2013-03-08 20:26:50 +01:00
Valentin Lorentz
c1f19b3353 Fix locales path resolution with Python 3. 2013-01-11 18:29:04 +01:00
Valentin Lorentz
6cbc6a14dd Rename all 'locale' directories to 'locales'.
Firstly, these directories contains more than one locale. Secondly, it conflicts with the 'locale' python module.
2012-12-26 15:43:35 +01:00
Valentin Lorentz
097ea23dfc Fix handling of PluginNotFoundException in i18n. 2012-12-22 00:06:26 +00:00
Valentin Lorentz
d58ad0c86f Reload translation of command helps when language changes. 2012-12-21 20:08:34 +01:00
Valentin Lorentz
989c674c58 Reset translation dict when reloading a locale. 2012-12-21 19:19:03 +01:00
Valentin Lorentz
97b48abaa2 i18n: Initialize translations in __init__. 2012-12-19 17:04:39 +00:00
Valentin Lorentz
089be4c8a5 src/i18n.py: Use 'str' as a base class instead of 'unicode'. 2012-08-05 13:48:11 +02:00
Valentin Lorentz
306105abad src/i18n.py: Fix encoding issue with Python 3. 2012-08-05 13:37:37 +02:00
Valentin Lorentz
505fd580f8 Use unicode in src/i18n.py 2012-08-04 12:09:11 +02:00
Valentin Lorentz
6ccfe95751 Prevent last string of a file from being untranslated if .po does not end with a blank like. 2012-07-30 14:33:22 +00:00
Valentin Lorentz
9d6b132233 i18n: Fix issue with the bot sending the repr() of the string on IRC when translation has 'new line' characters in it. 2012-04-17 11:45:25 +02:00
Valentin Lorentz
1c366a2899 src/i18n.py: fix error when running @reloadlocale with a plugin loaded before but not available any longer. 2011-06-28 19:52:18 +02:00
Valentin Lorentz
ebb3aae81c Raise an exception when plugin is not found instead of returning None in i18n.getPluginDir() 2011-06-17 15:36:38 +02:00
Valentin Lorentz
8979475e13 Fix compatibility with Windows ('u' flag not supported by open()) 2011-05-07 09:12:03 +02:00