Ticket #340 (closed task: invalid)

Opened 8 years ago

Last modified 3 years ago

Work on Internationalization

Reported by: Olivier Borowski <olivier.borowski@…> Owned by: NilsLindenberg
Priority: normal Milestone: 1.3.2
Component: localization Version: 1.1.6.2
Severity: normal Keywords: i18n l10n localization internationalization
Cc: dartar@…

Description

I'm working on some changes to translate messages and actions.

- convert all string to constants defined with : define ('AN_EXAMPLE', 'An example');

- move all "define" to an external file (e.g. english.php) loaded by wikka.php

First step is already partially included in trunk. The second would make language switching easier.

Some patchs are following...

Attachments

english.php Download (22.7 KB) - added by Olivier Borowski <olivier.borowski@…> 8 years ago.
External file for internationalization support
english.2.php Download (23.2 KB) - added by Olivier Borowski <olivier.borowski@…> 8 years ago.
External file for internationalization support (updated)
LoadPage.txt Download (3.0 KB) - added by Olivier Borowski <olivier.borowski@…> 8 years ago.
Changes to LoadPage();
LoadPage2.txt Download (2.9 KB) - added by Olivier Borowski <olivier.borowski@…> 8 years ago.
Fixed a bug in the previous LoadPage() proposal.
category.php Download (2.4 KB) - added by MasinAlDujaili 5 years ago.
checkversion.php Download (6.9 KB) - added by MasinAlDujaili 5 years ago.
update

Change History

Changed 8 years ago by Olivier Borowski <olivier.borowski@…>

External file for internationalization support

follow-up: ↓ 37   Changed 8 years ago by Olivier Borowski <olivier.borowski@…>

Detailed proposal:

- move all if (!defined('STRING')) define ('STRING', 'string'); to a separate file, for example : [english.php].

- maybe remove if (!defined('STRING')) as a string should never be redeclared.

- special pages name (like RecentChanges) are defined as a constant (RECENT_CHANGES) in english.php.

- in Wakka.class.php, LoadPage() replace RECENT_CHANGES with "RecentChanges", so a translated URL "../DerniersChangements" is interpreted as same as "../RecentChanges". See the code here : [LoadPage.txt]

- choose a default language in wikka.config.php and let the user choose his preferred language in UserSettings.

Changed 8 years ago by Olivier Borowski <olivier.borowski@…>

External file for internationalization support (updated)

Changed 8 years ago by Olivier Borowski <olivier.borowski@…>

Changes to LoadPage();

  Changed 8 years ago by DarTar

The idea of creating 'aliases' for default pages instead of (as we were planning) creating different sets of pages (based on different SQL dumps) for different languages is an interesting one. But we should consider the consequences on the overall architecture of Wikka.

Changed 8 years ago by Olivier Borowski <olivier.borowski@…>

Fixed a bug in the previous LoadPage() proposal.

  Changed 8 years ago by NilsLindenberg

see [273] (unfortunately marked with 344 instead of this :(

  Changed 8 years ago by DarTar

  • keywords l10n localization added
  • version set to 1.1.6.2
  • type changed from enhancement to task
  • milestone set to 1.1.7

since it seems that most of this ticket will be done soon (at least the l10n strings in lang/en.inc.php), I mark it for 1.1.7.

  Changed 8 years ago by NilsLindenberg

  • owner changed from unassigned to NilsLindenberg
  • status changed from new to assigned

  Changed 8 years ago by anonymous

Hello. Please, tell me what files of Wiki must be translated, a'll translate that to Russian. But there is problem with unicode/UTF-8. May be, i can use formatter from WackaWiki?

follow-up: ↓ 8   Changed 8 years ago by JavaWoman

I've extended the 'todo' list in the language file (lang/en.inc.php), to conform with previously-agreed guidelines for defining language strings:

@todo remove all HTML & Wikka formatting (marked with @@@):

leave text + % s replacement vars only

@todo make sure that punctuation is always part of defined phrase @todo document all replacement vars @todo use single quotes whenever possible

in reply to: ↑ 7   Changed 8 years ago by DarTar

Thanks! Please remember to cross-reference tickets and commits in both directions (SVN comments and ticket comments) for ease of management: [286]

  Changed 8 years ago by NilsLindenberg

@anonymus: To translate wikka into russian, you'll have to copy lang/en.inc.php and translate the strings there. Note that the file is not complete yet, so you'll better wait for the release of 1.1.7.

No, you can't use the formatter from Wackowiki. As for UTF-8, yes there are some problems. It may work if you search for all places with a language definition and set them to utf8 (especially the mysql connection) but I am not sure this will resolve all the problems.

  Changed 8 years ago by DarTar

[291] fixes a wrongly closed bracket in [286], which was breaking the output. Please test changes locally before committing them to the repository.

  Changed 8 years ago by JavaWoman

Big jump ahead with changeset [294], so large (46 files involved!) it was not possible to test it all quickly. ;) So (thanks to testing by NilsLindenberg and DarTar) the big change was quickly followed by a few small bugfixes in [295], [299] and [301].

See the commit message on [294] for what it all involves.

follow-up: ↓ 16   Changed 8 years ago by DarTar

  • cc dartar@… added

I see that at the end of the lang file there's a todo section marked with "Setup". Please don't spend time working on the installer, because this is currently being rewritten, so we'll have to make GUI string l10n-ready anyway.

  Changed 8 years ago by DarTar

[302] adds some preliminary instructions on how to correctly document language translation strings from a phpdoc point of view (see #244) .

  Changed 8 years ago by DarTar

[303] [304] fix issues with the phpdoc header

  Changed 8 years ago by JavaWoman

Added docblock templates to groups of defines in the language file ([307]). This should provide some documentation consistently for each define in the group.

Note that the short description ('define group.') is there only to make the real description the 'long' description: when docblock templates are merged, short descriptions are discarded and only long descriptions are used.

The long descriptions link to the file(s) where the defines are used with an inline {@link} to provide at least one-way linking without necessarily having to use a @uses tag for each define in the file that uses it (though that would be nice to add eventually :)).

in reply to: ↑ 12   Changed 8 years ago by JavaWoman

Replying to DarTar:

I see that at the end of the lang file there's a todo section marked with "Setup". Please don't spend time working on the installer, because this is currently being rewritten, so we'll have to make GUI string l10n-ready anyway.

Don't worry - I added the TODO section deliberately as a reminder that this needs to be done (maybe in a separate language file?) - not intending to spend any time on it. ;)

  Changed 8 years ago by DarTar

After compiling with phpdoc, I'm removing the useless 'define group' lines previously added by JavaWoman and adding a todo with further instructions on how to crosslink translation strings. [310]

  Changed 8 years ago by DarTar

[314] and [315] fix some further (minor) issues in phpdoc docblocks for the language file that were breaking the layout of the compiled documentation (group descriptions are treated as short descs and must be hence put on a single line).

  Changed 8 years ago by DarTar

[313] fixes a wrongly spelled constant name in usersettings.php

  Changed 8 years ago by DarTar

[316] removes an obsolete constant formerly used in {{diff.php}} and already merged by marjolein with an identical shared constant.

follow-up: ↓ 23   Changed 8 years ago by DarTar

Shouldn't we encode the language file as UTF-8 so it's ready to support translation in different languages?

  Changed 8 years ago by JavaWoman

[319] fixes a number of problems with the strings in fullscreen.php (found while testing fixes for #417).

in reply to: ↑ 21   Changed 8 years ago by JavaWoman

Replying to DarTar:

Shouldn't we encode the language file as UTF-8 so it's ready to support translation in different languages?

I agree we should - not sure if it stays that way when checking out or committing, but let's try. (Line endings seem to end up being DOS when checking out to a Windows machine, but getting converted back to Unix when committing - that confused me a lot...)

  Changed 8 years ago by JavaWoman

[322] has two minor fixes in mindmap.php and fullscreen.php. (sorry, referred to wrong ticket in there)

  Changed 8 years ago by JavaWoman

[323] has some fixes for the RSS feeds

  Changed 8 years ago by JavaWoman

[328] minor fix for textsearch(expanded)

  Changed 8 years ago by JavaWoman

[329] minor fix for category action

  Changed 7 years ago by DarTar

(In [414]) Fixing wrong link resulting from i18n works, refs #340

  Changed 7 years ago by DarTar

(In [444]) Missing l10n constant for {{system}} action. refs #340

  Changed 7 years ago by DarTar

(In [447]) Added fieldset and legend to form (refs #388) and fixed missing l10n strings (refs #340).

  Changed 7 years ago by DarTar

(In [449]) Fixing incorrect l10n strings and preliminary cleanup of {{feedback}} action with support for registered users. refs #486 and #340

  Changed 7 years ago by DarTar

(In [450]) Adding support for custom recipient in feedback form (read phpdoc header for detailed explanation); automatic replacement of sender data for registered users; adding a few configurable options; fixing l10n strings; refs #486 and #340 and closes #472

  Changed 7 years ago by DotMG

(In [454]) refs #486 and #340 [449] has a bug (redefining ERROR_EMPTY_COMMENT), fixed in this changeset.

  Changed 7 years ago by DarTar

(In [505]) Fixing wrong l10n strings, refs #340

  Changed 7 years ago by DarTar

(In [507]) Minor changes to newpage action:

  • fixing and consolidating l10n strings, refs #340
  • adding accessibility options, refs #388
  • adding page existence check
  • adding styling options, refs #380

  Changed 7 years ago by DarTar

(In [563]) Fix misspelled l10n string in footer, refs #340

in reply to: ↑ 1   Changed 7 years ago by JavaWoman

Replying to Olivier Borowski <olivier.borowski@gmail.com>:

Detailed proposal: (...) - special pages name (like RecentChanges) are defined as a constant (RECENT_CHANGES) in english.php. - in Wakka.class.php, LoadPage() replace RECENT_CHANGES with "RecentChanges", so a translated URL "../DerniersChangements" is interpreted as same as "../RecentChanges". See the code here : [LoadPage.txt]

I like the idea, not the implementation: this would mean every time we add a new "system" page (created by the installer) the LoadPage() function would need to be changed. We need an implementation that makes loading of system pages independent of the implementation of the Loadpage() function. A single change to enable this for all future changes would be OK, but not updating the function every time we add or remove installer-created pages.

  Changed 7 years ago by JavaWoman

  • keywords internationalization added

adding keyword: current work on this is actually internationalization, not localization.

  Changed 7 years ago by JavaWoman

(In [667]) "Relocatable Wikka" - part 6 (last of this set)

Handlers.

refs #470, #545

  • comments.xml.php:
    • use new config variable "feedcreator_path" (which may contain a relocated path) instead of string literal to build URI path to the FeedCreator class
    • uses instantiate() for PHP-version-dependent method to return an object reference
    • uses new object variable "base_url" instead of OBSOLETE configuration value "base_url" to use as source location
  • delete.php:
    • reformatted queries (slightly - needs more work)
    • uses new object variable "base_url" instead of OBSOLETE configuration value "base_url"
  • edit.php:
    • commented out dummy generation of header and footer since links aren't tracked there any more anyway
    • uses new config variable "wikiedit_uripath" (which may contain a relocated path) instead of string literal to build URI paths to the WikiEdit scripts
    • uses new config variable "wikiedit_uripath" (which may contain a relocated path) to build the variable $wikiedit_imgpath to pass as fourth parameter to the init() function of the WikiEdit object, so it can find its own images even if relocated. Note: WikiEdit already had this fourth parameter; it was just unused till now!
  • mindmap_fullscreen.php:
    • use constants WIKKA_LANG_PATH and CONFIG_DEFAULT_LANGUAGE to build paths to language file for selected default language and fallback language file (using system default language)
    • use constant ERROR_LANGUAGE_FILE_MISSING (in wikka.php) to generate error message if no language file can be found
    • use new config variable "freemind_uripath" instead of string literal to build URI path to the Freemind applet
    • a little cleanup (whitespace, naming)
  • recentchanges.xml.php:
    • use new config variable "feedcreator_path" (which may contain a relocated path) instead of string literal to build URI path to the FeedCreator class
    • uses instantiate() for PHP-version-dependent method to return an object reference
    • uses new object variable "base_url" instead of OBSOLETE configuration value "base_url" to use as source location
  • recentchanges.xml.php (note that even with the listed i18n changes i18n is not yet complete for this handler):
    • use FIRST_NODE_LABEL instead of string literal (i18n - refs #340)
    • use new object variable "wikka_url" instead of (OBSOLETE) config variable "base path" and constant WIKKA_URL_EXTENSION to build link to the current page
    • use WIKKA_ERROR_CAPTION and WIKKA_ERROR_ACL_READ_INFO instead of string literals to build error message (i18n - refs #340)
    • considerable cleanup (whitespace, coding guidelines)

  Changed 7 years ago by DarTar

(In [708]) Slight rewording of message for history handler (oldest edit=page creation), refs #340

  Changed 7 years ago by JavaWoman

(In [719]) Advanced FormOpen()

  • Wakka.class.php:
    • replacing FormOpen() by an adapted version of the "advanced" version available and operational on wikkawiki.org
    • adding a new existsHandler() method to support this
  • files.php action:
    • now uses advanced FormOpen() to build upload form - refs #72
  • more work on internationalization - refs #340
  • language file (en.inc.php)
    • standardized and expanded strings for files action - refs #340

Note:

The new FormOpen() now does away completely with the silly "hidden" field that seems to have been "necessary" at some time in the past to make form submission work when rewrite_mode is not on. It is no longer necessary: FormOpen() uses Href() which provides a complete action URL including a wakka parameter. Another case of replacing addressing symptoms by addressing causes...

refs #496

  Changed 6 years ago by DarTar

  • milestone changed from 1.2 to 1.3

Retargeting to 1.3. Code for this ticket may have already been committed to trunk, from which 1.3 will be branched. Consider backporting urgent issues to 1.2.X

  Changed 5 years ago by MasinAlDujaili

I am currently working on isolating string constants in files where they are still hard coded. Where shall I put my efforts? I'll append actions/category.php & actions/checkversion.php.

Changed 5 years ago by MasinAlDujaili

Changed 5 years ago by MasinAlDujaili

update

  Changed 4 years ago by BrianKoontz

  • milestone changed from 1.3 to 1.4

  Changed 4 years ago by DarTar

(In [1652]) [m] Removed redundant punctuation from search tips, refs #340

  Changed 4 years ago by DarTar

(In [1655]) Converting German lang file to UTF-8, refs #684 and #340

  Changed 4 years ago by DarTar

(In [1656]) Replacing hardcoded string, refs #340

  Changed 4 years ago by DarTar

We should either change the milestone and description of this ticket to reflect the new gettext-based implementation or close this as obsolete.

  Changed 4 years ago by BrianKoontz

  • status changed from accepted to closed
  • resolution set to invalid

  Changed 3 years ago by BrianKoontz

  • milestone changed from 1.4 to 1.3.2
Note: See TracTickets for help on using tickets.