HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Finding Translation Candidates, Configs, and Fired Events

R_JR_J Admin
edited June 2014 in Tutorials

Inspired by this issue I've searched for a way to get all strings in Vanilla that have to be translated. So I've started playing around with regular expressions but ended up with PHPs tokenizer. Great tool!
In order to be able to really play around with the data, I've exported it to excel. Another thing I've learned and found it to be really easy :) I've attached my script so you can play around, too.

I've found 1.880 usages of the functions T, BigPlural and PluralTranslate. 1.761 are simple T functions with "only" 1.147 (roughly 2/3) unique strings.

The remaining function calls contain translatable data in a way that is more complicate to deal with. Those 119 functions have 82 unique parameters and only 40 of them contain strings (e.g. T($Discussion->Sink == '1' ? 'Unsink' : 'Sink')).
The rest is untranslatable by just looking at the code that way: eg T($this->Data['Title']) makes a string translatable but it is not obvious how to do it...

So what is this all about? 1.147 simple translations + 40 "complex" translations (containing up to 4 strings) will add up to a maximum of around 1.300 translations. Add the 79 unsure usages of T/PluralTranslate/BigPlural to that and you are still below 1.400, but German transifex has 978 + 907 = 1.885 definitions :o

Well, I've started this experiment to find a way of checking if every string in the source code has been translated and ended up with about 20% more translations than I've expected! Strange thing. Maybe I'll try to match the definitions with my excel and see what I will find out.

Yours faithfully

Count von Count

http://www.youtube.com/watch?v=3e7yYBDHOgg

Comments

  • peregrineperegrine MVP
    edited May 2014

    lol and awesome! @‌r_j

    post an mp3 with "you" singing along with the count.

    you inspired by me, me inspired by you.

    do you have the latest transifex from github - I believe Todd got rid of lots of translations at least for other langs.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • LincLinc Admin

    Pure speculation: This may, in part, be an artifact of having all-version locales. Our locales are for 2.0.18, 2.1, and 2.2, which of course will have some differences.

  • R_JR_J Admin

    @peregrine: In fact it is the same annoyance as the last time I wanted to get a copy of the language files: I do not know my login credentials. But I can open the side (https://www.transifex.com/projects/p/vanilla/language/de_DE/) and hovering over the progress bars shows me some statistics.

    @Linc: I guess there are some translations that belong to hosted plugins: $Definition['Add Badge'] is included. That will add some more lines.

  • peregrineperegrine MVP
    edited May 2014

    very very, slick program @r_j.

    I even found folders that I set the wrong permissions with it (wrong read permissions and ownership). a beneficial side effect.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited May 2014

    hey @r_j - you probably already did this. or if you may have improvements to it.

    the same idea as Translations.

    but this one produces a spreadsheet of configuration statements in programs. C5.php

    and one for events based on fireveent F5.php

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • R_JR_J Admin

    Funny thing is, I haven't done it, but yesterday evening thought about doing it today - at least for the configs :D

  • peregrineperegrine MVP
    edited June 2014

    can you move this to tutorials please @kasper if its ok with @ r_j

    and maybe change the title - Tools for collecting definitions, configs and fireevents

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited July 2014

    Just yesterday, I was diagnosed with ohrwurm by the famed Doktur @R_J it may only affect humans and birds, don't worry it won't do anything to your computer. Although I've had the malady since May.

    Ever since I watched the counting video in r_j's opening post above, I can't get the song out of my mind.

    and what's worse. I see the images of the count singing as well.

    So I think I may also have augewurm as well.

    I don't know how long this condition may last. just wanted to give folks a heads-up lest they become victims of the ohrwurm (and its left-handed enantiomer earworm). Its kind of entertaining, but at times you may not want to be counting. It also makes it difficult while counting change and paying for things at the store. And for non-english speakers you will learn to count to four by the end of the video.

    there may be a cure here:

    http://www.npr.org/2012/03/12/148460545/why-that-song-gets-stuck-in-your-head

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • edited July 2014

    Warum will ich auch und drücken lol auge? Ihre schriften sind sowohl aufschlussreiche und lustige

Sign In or Register to comment.