2
0
mirror of https://github.com/koreader/koreader synced 2024-11-04 12:00:25 +00:00
Commit Graph

37 Commits

Author SHA1 Message Date
NiLuJe
dcb11c2542
Make luacheck >= 0.26 happy (#9174)
Re: https://github.com/koreader/koreader-base/pull/1487
2022-06-11 19:06:06 +02:00
Frans de Jonge
a8db251bd8
[chore] Remove leftover debug print (#9080) 2022-05-07 18:38:26 +02:00
Frans de Jonge
8da18d403b
[i18n] Enable Latvian translation (#9079)
Cf. <https://github.com/koreader/koreader/issues/8225#issuecomment-1120181554>.
2022-05-07 18:36:06 +02:00
NiLuJe
23cd7e24bb
Minor Lua I/O cleanups (#8921)
Mostly making sure we always explicitly close io handles.
2022-03-19 23:57:31 +01:00
Frans de Jonge
1c8ab19f83
[fix] gettext: don't replace backslash characters (#8511)
Everything in string.gsub() is replaced, not only the matching group. By using two groups, we can correctly return the full matched string when none of the special conditions apply.

Fixes <https://github.com/koreader/koreader/issues/8486>.
2021-12-04 19:01:12 +01:00
Frans de Jonge
0aab7d7378
[fix] gettext: unescape \\ for ID matching (#8357)
Fixes <https://github.com/koreader/koreader/issues/8356>.
2021-10-28 17:48:23 +02:00
Frans de Jonge
6cc0ab8dc9
[fix] Always initiate empty context table (#6874)
In case of no environment language. I suppose that doesn't tend to happen much in the wild since I added the offending code early in 2020. ;-)

Fixes <https://github.com/koreader/koreader/issues/6873>.
2020-11-13 16:54:01 +01:00
Frans de Jonge
4a3710b6d3
[i18n] Add support for fledgling Hebrew translation (#6333)
See <https://hosted.weblate.org/languages/he/koreader/> if you'd like to contribute.
2020-06-30 17:20:03 +02:00
Frans de Jonge
d64e143297
[i18n] GetText: ignore fuzzy strings (#5807)
Strings are prefilled by msgmerge with closely matching ones to reduce the amount of labor required by the translator. Often the string requires only minor adjustment, making the process faster, and when the string isn't a good match it's no big deal. However, these so-called fuzzy strings shouldn't be treated as if they were actually translated.

Fixes the effect seen in <https://github.com/koreader/koreader/issues/5806>.
2020-02-03 12:11:07 +01:00
Frans de Jonge
3436e47367
[fix] Update hardcoded gettext workaround for Romanian (#5718)
Fixes #5661.
2020-01-01 20:41:42 +01:00
poire-z
6596e5ddc7 [RTL UI] GetText/Bidi: wrap untranslated strings in LTR 2019-12-17 23:46:35 +01:00
Mihai Vasiliu
739a3009ff [i18n] Fix Romanian plural forms (#5692)
Hardcode the plural forms logic for Romanian.

This fixes #5661 and enables Romanian (Moldova) language in the menu.
2019-12-16 20:21:07 +01:00
Frans de Jonge
50878eab9e
[fix] Tailor plurals match (#5603)
Fixes #5601.
2019-11-18 12:41:22 +01:00
Frans de Jonge
b8b6abe4d4
[fix] GetText: Support Arabic plurals (#5517)
Fixes <https://github.com/koreader/koreader/issues/5516>.

Cf. <https://github.com/koreader/koreader/pull/5515>.
2019-10-21 18:29:40 +02:00
Frans de Jonge
621f36b4a9
[fix] GetText: guard against empty strings in translation (#5301)
Fixes <https://github.com/koreader/koreader/issues/5293>.
2019-09-01 16:31:37 +02:00
Frans de Jonge
cddca1a5b5
[fix] Remove gettext util dependency (#5270)
A simple `string.gmatch()` should do the trick here, which avoids the need for refactoring.

Fixes <https://github.com/koreader/koreader/issues/5269>.
2019-08-26 16:51:45 +02:00
Frans de Jonge
3ab51b1f85
[spec] Test all gettext codepaths & support language with no plurals (#5260) 2019-08-25 12:39:42 +02:00
Frans de Jonge
06d26ed13e [doc] gettext developer docs 2019-08-25 11:44:43 +02:00
Frans de Jonge
2c555830f9
[feat, i18n] Implement ngettext (#5257)
Fixes <https://github.com/koreader/koreader/issues/5249>.

See https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html and https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html for more information.

Usage:
```lua
local T = ffiUtil.template
local _ = require("gettext")
local N_ = _.ngettext

local items_string = T(N_("1 item", "%1 items", num_items), num_items)
```
2019-08-24 23:06:06 +02:00
Frans de Jonge
0067c8f29e
[i18n, feat] Add basic context (msgctxt) support (#5234)
References https://github.com/koreader/koreader/issues/5232

Given an entry in the PO file like the following:

```
msgctxt "systemstat"
msgid "    Total"
msgstr "Totaal"
```

It can be addressed using:

```lua
local _ = require("gettext")
local C_ = _.pgettext
C_("systemstat", "    Total")
```

This allows to distinguish between separate instances of the same string, for example "Pages" meaning "Number of pages" and "Pages" meaning "Display of pages".

Extraction of this code pattern is not yet implemented by nightswatcher. xgettext didn't yet support Lua back in 2013 when all this was first added to the program, but now it does. Therefore it might make the most sense to replace the current Python extraction script with xgettext itself.

By default it only understands gettext.pgettext(), but that can be addressed by passing some extra command line arguments, for example:

```
xgettext -l lua -c --keyword=C_:1c,2 *.lua
```
2019-08-21 19:40:15 +02:00
Martín Fernández
b15c2ed0c5 [Android] misc fixes (#4478)
* use product as device model
* print android version (codename + number) + api at launch
* exit the application properly
* fix fullscreen switching (and disable it on newer android versions)
* gettext: lower log level for message: cannot open translation file
* android common settings refactor
2019-01-17 21:44:15 +01:00
anarcat
78fbc145e4 turn missing translations into a warning (#3752)
This is not fatal and can be mistaken by new users for the cause of all their problems, like I did in #2621.
2018-03-14 15:15:14 +01:00
Frans de Jonge
a394e644b5 Add gettext_spec stub (#3343) 2017-10-11 14:22:11 +02:00
Frans de Jonge
9ece6408f3 [fix] gettext: die already you stupid language not found error (#3341) 2017-10-11 13:57:23 +02:00
Huang Xin
a4e1a3ba5e reflect changes in koreader/android-luajit-launcher#62 (#3254) 2017-09-24 05:58:34 +08:00
Frans de Jonge
7545d38198 fix: really skip en_US:us in gettext.changeLang
`new_lang` isn't `en_US` but `en_US:en`

Also see https://github.com/koreader/koreader/issues/3069#issuecomment-321769322
2017-08-11 14:56:23 +02:00
Qingping Hou
a1ec64b3ed chore: skip en_US in gettext.changeLang 2017-04-16 22:41:36 +02:00
Frans de Jonge
69b826781a gettext: unescape quotation mark
Fixes #2718.
2017-04-04 07:59:45 -07:00
Qingping Hou
f95ad00b9e feat: add logger module & rewrite kobo suspend script in lua 2017-01-02 19:52:09 -08:00
Frans de Jonge
ab442c2434 gettext: unescape \n
Fixes the problem that any msgid with \n in it wouldn't show up translated.
2014-11-19 21:46:45 +01:00
chrox
20bd14d588 automatically set language on Android 2014-06-08 21:32:45 +08:00
chrox
88061b323e strip encoding suffix in locale name like zh_CN.utf8
So that we can automatically change to language defined in
the LANGUAGE or LANG env variable.
2014-06-08 20:48:37 +08:00
Hans-Werner Hilse
6bbfae389a don't accept empty strings as valid translations 2014-05-23 11:57:33 +02:00
HW
ed982d3c95 Added a pure Lua gettext implementation 2014-05-22 22:47:14 +02:00
chrox
92219a1f1e cleanup: expand tab to 4 spaces 2014-03-13 21:52:43 +08:00
HW
ef111b99c6 Refactored to use strictly locals 2013-10-18 22:38:07 +02:00
Qingping Hou
31f3564158 add gettext lua module 2013-04-07 16:09:33 +08:00