[geeklog-devel] CrowdTranslation-LANG array mapping

Benjamin Talic b.ttalic at gmail.com
Fri Jun 21 18:40:59 EDT 2013


Thank you for the reply Wim,
What you proposed is more or less what I had in mind.
But the current problem is actually identifying which strings should be
translated, that is which of the strings on the page are generated
from the language arrays.
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, but with the first
change to geeklog the plugin would get  useless. Unless future developers
would go with adding the span (which I doubt).
Another thing which came to mind is to make the plugin, upon install get
all the geeklog php files as strings and add those spans programmatic.
Something like

 $edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.'
. $_IMAGE_TYPE . '" alt="' . $LANG01[48]
. '" title="' . $LANG01[48] . '"' . XHTML . '>';

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 . '>';

Or what would be much faster, and more reliable, to let the plugin alter
the actual language files and add such a span prefix to the arrays.

If I could do something like that I could use the jQuery selector to
identify the strings on a page. If we talk about expanding this to other
plugins and such the difference would be that I would have several classes
for the span such as class="translator_core",
class="translator_plugin_name"...

Would some of those approaches be acceptable?


Ben


On Sat, Jun 22, 2013 at 12:03 AM, Niemans <niemans at nlbox.com> wrote:

>
> Depends on what you want the effect to be when you find all the
> occurrences in the page.
> On first sight I do have two different thoughts:
>
> 1. Assuming that the effect you are pursuing is a effect that the user
> wants, since he/she is involved in the translating:
> 1.1 Adjust the Language arrays that need translation: add a <span> tag
> with a general class to every item; add a id (=index) if necessary
> 1.2 Add some css that highlights the text
> 1.3 Add a click event so that a editor can pop up (and don't interfere
> with real links)
>
> 2. Assuming the user is translating item by item:
> 2.1 The problem drills down to finding the page(s) in the Geeklog
> module/plugin that contains that specific item (hard to do for validation
> text or error messages)
> 2.2 Do the same as 1.1 upto 1.3, but now for the target translation
> language only; maybe limit this to untranslated items
>
> Above seems difficult to achieve. Think of adding a new language :
> "myTranslation". And switch languages after finishing each translated item.
>
> Than, finding target text in the displayed page looks like a javascript
> endeavor: scan the DOM elements for the text (or all <span>tags). You may
> catch titles, alt-attributes, form values etc. too.
> Maybe xslt, xQuery or xPath could be used, though they are slow too.
> And you could load the php array into javascript of course, which is
> similar to persistence.
>
> Wim
>
>
>
>
> Op 21 jun. 2013, om 23:17 heeft Benjamin Talic het volgende geschreven:
>
> > Hi All,
> >
> > Again I have run into a problem with the plugin. I have been trying to
> figure out a good solution for days...
> >
> > The problem:
> > Once a page is loaded the plugin should kick in and find all text which
> is essentially from the LANG arrays from the language file.
> > All the solutions I have come up with are bad and I have run out of
> ideas.
> >
> > Here is what I have:
> >
> > 1) Assuming that the default site language will not change put all the
> LANG files inside a database table (also saving the data from which array
> it originally came and under which index).
> > Later on use the text (or HTML) of the shown page to find all matches
> between what is displayed to the user and what is in the database table.
> The same thing could somewhat be improved if I would use a persistent PHP
> array so that the database is queried only once.
> >
> > 2) Have a list of all available LANG arrays and loop through them to
> find macing strings. This would probably take a very long time.
> >
> > Both approaches have the same problem, if the page contains a
> story/comment with the text "We could save the city" it could identify the
> save from that sentence as a element of the LANG32 array.
> >
> > Any nudge in the right direction would be much appreciated...
> >
> > Thanks in advance
> > Ben
> > _______________________________________________
> > geeklog-devel mailing list
> > geeklog-devel at lists.geeklog.net
> > http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>



-- 
Regards,
Benjamin


home:         http://summergeeek.blogspot.com/   nvandgsoc.blogspot.com
skype:         benjamintalic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist8.pair.net/pipermail/geeklog-devel/attachments/20130622/4d36539b/attachment.html>


More information about the geeklog-devel mailing list