Ticket #1593 (new enhancement)

Opened 2 years ago

Last modified 2 years ago

Auto add untranslated translations

Reported by: ed209 Assigned to: somebody
Priority: normal Milestone: 1.0
Component: SGL - String Severity: open
Keywords: Cc:

Description

sounds better in the title... Having been lazy about adding {translate(##)} throughout my templates, I am now doing this retrospectively. It's quite labor intensive, but I have managed to make it easier with dreamweaver code snippets to wrap the {translate(##)} with keyboard short-cuts, but also by adding this to SGL/String.php

if (isset($conf['debug']['showUntranslated']) && $conf['debug']['showUntranslated']) {
    require_once 'File.php';
    $file = "/Users/ed209/Sites/artflock_v3/UNTRANSLATED.txt";
    $str = "'" . $key . "' => '" . $key . "',\n";
    //$str = "\$defaultWords['" . $key . "'] = '" . $key . "';\n";
    $e = File::write( $file, $str, FILE_MODE_APPEND );
    $key = '>' . $key . '<';
}

When retrospectively adding translations, I go through the template, wrap {translate(##)} around relevant text then refresh that page in my browser. The above code writes my array elements, ready formatted to the specified file which I just then copy/paste to my module/lang/lang-file.php. Big time saver.

I'm not sure if this could be taken any further. To be really useful, it should detect all untranslated strings in a file and ask if they need including into module/lang/lang-file.php - a huge task. Also the above doesn't check for duplicate strings. At this stage it's more of a tip, not sure if it's worth taking any further... but worth a mention.

Change History

03/23/08 08:57:19 changed by demian

  • milestone changed from 0.7.0 to 0.9.0 - polishing.

Milestone 0.7.0 deleted