Things to look for when porting to Drupal 6:

- menu hook needs array to be parsed for title and description (code is in potx.inc, but commented out for Drupal 5)
- watchdog hook changed, so message should be grabbed without a t() wrapper present
- format_plural() changed and now accepts extra parameters

Also for supporting the Drupal 6 'translations' directory format:

- pot PO files where they belong under the code or build up an independent directory structure with the files
- note that to put general.pot to a proper place we should know the "default module" in case we are dealing with a module set (the default module is the one the others are based on, and which is a base requirement... this is sometimes named after the project, sometimes not)

Comments

hass’s picture

subscribe

Gábor Hojtsy’s picture

- .info files are in a new format, so we need to parse them with Drupal 6's drupal_parse_info_file(), but it does not seem like we have any new keys to look after for translatable strings
- JavaScript files can also contain Drupal.t() and Drupal.FormatPlural(), and luckily we just have code right in Drupal 6, which we can lift for potx

Huh, quite a few stuff to do for Drupal 6.

Gábor Hojtsy’s picture

Also:
- _locale_get_iso639_list() was renamed to _locale_get_predefined_list()

(There are other issues with how translations are exported, but they are not extraction related, so I will not list them here).

Gábor Hojtsy’s picture

Just committed a port of the interface, so the module interface now works nicely in Drupal 6. The extraction itself need to be fixed through with the issues listed up here.

Gábor Hojtsy’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Status: Active » Fixed

Well, this took nearly all my Sunday, but here it is: http://drupal.org/cvs?commit=84560

Parser changes for Drupal 6 compatibility done over the weekend:
- we use dots in file names so we should use pathinfo() instead of plain old explode()
- added JS parsing based on core regex code with custom error reporting, now parsing .js too
- watchdog() parameters changed, now t() should not be used
- the menu hook changed, we identify title and description values if literals (otherwise throw an error)
- format_plural() calls now accept arguments, so we allow a comma after the plural string
- .info file format changed, so we need to use drupal_parse_info_file() for parsing

Note that I did not implement a code extract for the error message due to some laziness
(it requires watching until the line end, for which we have no code yet, and it needs
to take nesting into account), otherwise new functionality signals errors as before.

(This code also helped identify some watchdog(t()) issues in Drupal 6 which I'll file an issue to fix).

So if someone steps up with better menu hook error reporting, or any bugs or missing functionality in the Drupal 6 version, feel free to step up. I consider this done for now, and will not actively look for missing stuff (only fix issues I came across myself or reported in the issue queue).

The Drupal 6 directory structure task will be handled differently it is not a parsing issue, so I was mistakenly mentioning it here.

Anonymous’s picture

Status: Fixed » Closed (fixed)