[geeklog-devel] CrowdTranslation-LANG array mapping
Niemans
niemans at nlbox.com
Sat Jun 22 14:39:37 EDT 2013
Another option would be to sit inside COM_createHTMLdocument/Template.class and let the template parser replace language dependencies.
But if I understand correctly what everybody is saying, than the direction is a Language.class and/or a Translation.class.
I.E. $LANG01[48] will become in the source code $LANG01->get(48) or alike. The object can respond depending on what is the case, and, important, can trace the use of every item.
Here some interesting links on how this is done elsewhere:
http://fuelphp.com/docs/classes/lang.html
http://www.php4every1.com/tutorials/multi-language-site/
Maybe this is useful for designing the API.
Wim
Op 22 jun. 2013, om 16:56 heeft Dirk Haun het volgende geschreven:
> Ben wrote:
>
>> The easiest way for me would be to "simply" go through the source code and add a span everywhere where a LANG array is called
>
> You could do that at runtime (see code snippet below). May need a new plugin api somewhere, though, depending on when exactly you wanted to do it.
>
>
>> would become
>>
>> $edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.'
>> . $_IMAGE_TYPE . '" alt="' ."<span class="translator">". $LANG01[48] ."</span>"
>> . '" title="'."<span class="translator">" . $LANG01[48] ."</span>" . '"' . XHTML . '>';
>
> And that's a problem right there: The <span> tag is not allowed inside a title attribute. Same goes for button texts and a few other things. So there are some text strings that have to stay plain text. I'm afraid figuring out which ones at runtime is pretty much impossible.
>
> Hmm …
>
> bye, Dirk
>
> --- snip ---
> <?php
>
> $LANG42 = array(
> 1 => 'Hello',
> 2 => 'World'
> );
>
> echo $LANG42[1] . "\n\n";
>
> $_lang42 = array();
>
> foreach ($LANG42 as $key => $value) {
> $_lang42[$key] = '<span>' . $value . '</span>';
> }
>
> $LANG42 = $_lang42;
>
> echo $LANG42[1] . "\n\n";
>
> ?>
> --- snip ---
>
>
> --
> http://www.themobilepresenter.com/
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>
More information about the geeklog-devel
mailing list