Commit Graph

194 Commits (5efda4da294e37a98b04561f475b186ae8c64138)

Author SHA1 Message Date
Joey Hess c56ff6cd47 relocate po directory up a level 2009-07-21 13:16:26 +02:00
Joey Hess 637f32480c turn off pot file underlay again 2009-07-21 12:40:44 +02:00
Joey Hess cebffa917f improve invalid gettext message
(and gettext it as translators will see this!)
2009-07-21 12:39:21 +02:00
Joey Hess 1610b1e9e6 update 2009-07-21 12:38:40 +02:00
Joey Hess 7532eff2b7 update 2009-07-21 11:40:25 +02:00
Joey Hess eca2dbe67f po: Add support for mo files in underlays
In order to support translated basewiki and other underlays, we need
support for mo files in underlays.

The code did not allow this before, because if a mo file was in an
underlay, then it might try to update it, and its pot, and write to the
underlay, which is guaranteed to either fail due to permissions, or be
undesirable.

To fix, my approach is to just detect if a mo or pot file that is about to
be updated is in an underlay, and skip updating it. This seems to work
well:

- If the mo is out of date in the underlay, it won't get updated, but this
  would probably be due to a problem in the underlay, or more likely,
  the wiki is being rebuilt and so it *thinks* the mo is out of date,
  but it's really not (and it would be a waste of time to rebuild it
  anyway).
- If a page from the basewiki is edited, it is saved to the srcdir,
  which causes generation of an updated mo and pot also in the srcdir;
  the underlay stops being used for that page, and everything seems
  to work.

Note that I am not including an underlay search directory for pot files.
They *seem* to be unnecessary for the underlay, since the mo files
in there never need to be updated.
2009-07-21 11:31:51 +02:00
Joey Hess 4b1534d5bc fix example 2009-07-21 09:56:34 +02:00
Joey Hess e04692e059 po: Support running with a non-english master lang; add translated underlays
It seem to make sense to remove the check for there being slave languages
as part of this, since one might want a wiki that is only in non-English.
2009-07-20 07:19:05 +02:00
Joey Hess 741c33576e create translated underlays in mdwn format
These are for use by wikis where the primary language is not English.
On such a wiki, it makes sense to use an underlay has the source for pages
in the native language.
2009-07-20 06:23:33 +02:00
Joey Hess 126952bd33 avoid Po4a::Common exporting anything
It exports gettext and stuff by default, which conflicts with IkiWiki
exports.
2009-07-19 17:50:56 +02:00
Joey Hess 43e5c905cb shut up msgmerge 2009-07-19 16:54:03 +02:00
Joey Hess ea8c166a05 bugfix: Avoid generating po files for files that are not httmlizable 2009-07-19 13:46:10 +02:00
intrigeri 091f11be76 po: better discussion link logic
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-06-03 18:30:00 +02:00
Joey Hess 53b1c6f559 Merge commit 'intrigeri/po' into po 2009-05-19 13:06:35 -04:00
intrigeri 9db2438b3a po: remove unneeded check on link plugin
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-04-20 11:38:15 +02:00
Joey Hess e827247a86 wrapping 2009-03-29 15:48:26 -04:00
Joey Hess 4e9db780d5 whitespace 2009-03-29 14:52:29 -04:00
Joey Hess c84b4cefcc minor code changes 2009-03-29 14:31:32 -04:00
intrigeri 8cfe428a28 rename hook: run once per file to be renamed
... as Joey suggested on todo/need_global_renamepage_hook

This hook is applied recursively to returned additional rename
hashes, so that it handles the case where two plugins use the hook:
plugin A would see when plugin B adds a new file to be renamed.

The full set of rename hashes can no longer be changed by hook functions, that
are only allowed to return any additional rename hashes it wants to add.
Rationale: the correct behavior of the recursion would be hard, if not
impossible, to define, if already considered pages were changing on the run.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-03-08 11:44:00 +01:00
intrigeri ea753782b2 po: remove all dependencies on nicepagetitle
... as my meta branch probably won't be merged before the po plugin is, contrary
to what I was originally supposing.

This implies removing the po_translation_status_in_links and
po_strictly_refresh_backlinks options.

Added a note to the TODO section to think of bringing these features back later,
as they really enhance user experience on a translatable wiki.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-27 17:52:32 +01:00
intrigeri 51badc960d rename hook: instead of modifying the passed-by-name array, return a copy
This is intended to solve Joey's concerns expressed on
http://ikiwiki.info/todo/need_global_renamepage_hook/, i.e. the need to make it
possible to use this hook from external plugins.

A plugin using this hook still can add/modify/remove elements of the
@torename array.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-27 17:08:55 +01:00
intrigeri ca9e45c3ba po: make the "backlinks involve dependencies" feature optional
It can now be configured with the po_strictly_refresh_backlinks setting.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-27 00:25:46 +01:00
intrigeri 8915d2553c po: bring back a useful use of scalar
... that was removed in 68869d664b

Without this scalar, a two-cells array is passed to $template->param, which
builds a hash with an odd number of elements.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-26 23:21:14 +01:00
intrigeri 78a095aa42 only pass named parameters to the canremove hook
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-26 23:07:19 +01:00
intrigeri f02672c113 only pass named parameters to the canrename hook
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-26 23:02:31 +01:00
intrigeri e0e94d4716 po(formbuilder): stop hunting down non-existent cases
After some thinking about it, I can't find why the type of a page being created
in the CGI could be restricted to po. So the previous case seems enough.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-26 22:54:40 +01:00
Joey Hess 9750f929ad remove redundant use
use is file-scoped so warnings and strict are already enabled
inside the second package, and IkiWiki is already loaded
(though not imported into this context)
2009-01-26 13:35:50 -05:00
Joey Hess 9e3dc0af60 non-code changes 2009-01-26 13:33:02 -05:00
Joey Hess aff9bf5a7a more unnecessary parens 2009-01-26 13:28:57 -05:00
Joey Hess 093f8534f1 avoid keeping running if a DOS attack is possible 2009-01-26 13:25:05 -05:00
Joey Hess 98f0d672df remove unnecessary parens 2009-01-26 13:24:33 -05:00
Joey Hess c5642119f7 another useless use of scalar
scalar(undef) is undef, so using scalar here had no effect.
Instead make the function return "", probably avoiding an uninitialized
value warning.
2009-01-26 13:21:33 -05:00
Joey Hess 68869d664b remove useless uses of scalar
if (scalar @array) is written idiomatically in perl as
if (@array).
2009-01-26 13:20:56 -05:00
Joey Hess 526d9dbe10 improve some english
I'm still not happy with the clarity of this warning message.
I don't understand when it could happen or why a warning is needed.
2009-01-26 13:15:29 -05:00
Joey Hess 8e738066bc avoid standalone -e or foo syntax
I prefer to use either of the other two syntaxes perl offers, and not this
one.
2009-01-26 13:10:37 -05:00
intrigeri f8c306a21b remove cansave plugin, now replaced by Joey's checkcontent one
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-19 19:53:32 +01:00
intrigeri df82b5e62a po: when possible, disable use of Text::WrapI18N in po4a; else warn about too old po4a
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-16 15:07:05 +01:00
intrigeri 523718b181 po(change): re-render all rendered files in one corner case
All meta titles are first extracted at scan time, i.e. before we turn
PO files back into translated markdown; escaping of double-quotes in
PO files breaks the meta plugin's parsing enough to save ugly titles
to %pagestate at this time.

Then, at render time, every page's passes on row through the Great
Rendering Chain (filter->preprocess->linkify->htmlize), and the meta
plugin's preprocess hook is this time in a position to correctly
extract the titles from slave pages.

This is, unfortunately, too late: if the page A, linking to the page B,
is rendered before B, it will display the wrongly-extracted meta title
as the link text to B.

On the one hand, such a corner case only happens on rebuild: on
refresh, every rendered page is fixed to contain correct meta titles.
On the other hand, it can take some time to get every page fixed.
We therefore re-render every rendered page after a rebuild to fix them
at once. As this more or less doubles the time needed to rebuild the
wiki, we do so only when really needed.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-16 01:33:07 +01:00
intrigeri 3ba976d1d3 po: pages in underlay dirs are not translatable
Fixes build break due to read-only underlay dirs, e.g. basewiki.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-15 23:04:57 +01:00
intrigeri 9abda92324 po(_istranslation): fix unitialized value
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-15 22:45:45 +01:00
intrigeri 5c59ad63df po: fix broken links from slave pages
... by overriding cgiurl.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-15 21:49:32 +01:00
intrigeri 196f03a987 po: do not add translation status to parentlinks
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-13 13:03:30 +01:00
intrigeri 4fd2807886 po(isvalidpo): more meaningful error message
... explaining how to go on with edit.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-02 18:57:50 +01:00
intrigeri 4ad871810d po: back to the cansave hook, as the form validation is not sufficient
Form validation works, but after trying to save invalid PO content, the user is
brought back to the page he/she was editing, without any single clue to explain
why it was not saved. The dedicated cansave hook is thus necessary.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-02 18:51:32 +01:00
intrigeri 7ef0c19cdf po: first attempt to replace cansave hook with form validate tweaks
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-02 17:51:17 +01:00
intrigeri 33f9eeb4fb po/i18n: move the function names out of the translatable strings
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-02 17:24:54 +01:00
intrigeri da26603e07 po: updated copyright years
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-02 16:54:03 +01:00
intrigeri fae3cef41a po(formbuilder_setup): remove the rename/remove buttons on slave pages
This has to be done after the rename/remove plugins have added
their buttons, so we set this hook to be run last.

The canrename/canremove hooks already ensure this is forbidden
at the backend level, so this is only UI sugar.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-02 16:02:25 +01:00
intrigeri e5222db332 po: avoid warnings and possible bugs with nested named subroutines
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-02 15:14:58 +01:00
intrigeri 14a79751e3 po: gettext-ize error messages
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-02 15:00:34 +01:00