Automagic_translation v0.1

Release Notes

This plug-in automatically detects your visitor's language and uses it instead of the site's default language.  That way, your site is automatically translated, whether users are logged in or not. You need to have language packs installed for this plug-in to translate your site.

Automagic_translation settings

NOTE: This plug-in requires you to make changes to a core file, languages.php.  You will need to replace engine/lib/languages.php with the languages.php file provided.  The reason behind this is that Elgg 1.5 loads plug-ins after it has already loaded the login page, index page and other core components.  By the time this plug-in is loaded, those pages have already been created in the site's default language, so they can no longer be translated.  But don't worry -- the changes made are not specific to my plug-in, in the hope that they can make it into the next Elgg release.

 

To see this plug-in in action, visit http://oakpages.com.  Then, change the language in your browser's preferences and refresh the page.  OakPages.com will now be presented in the language you just selected!

 

  • can you please explain a bit more how your plugin works. Does the plugin translate everything on the website automatically ?

     

  • i tested it and see how it works,  thanks for the plugin.

  • @ash -- this plug-in translates the whole site *if* you have the appropriate translation files installed.  Basically, instead of having a site-wide default language (set by the administrator), the side-wide language is dinamically set depending on your visitor's language.

     

    Example.  Let's say your site's default language is English.  Without this plug-in, any visitors to your site from Central America or Spain who's browser language is Spanish will see your site in English and will probably never signup for an account.  With this plug-in, they will see your site in Spanish, and when they signup for an account, their personal language preferrence will also be set to Spanish automatically.

     

    Makes sense?

  • Wow is that download number correct I cannot believe that, there must be something a little screwy somewhere

    Back to the topic This is a greatly needed plugin I will test this out Thanks for your work on this

  • @ Great plugin idea Gabriel,you mention we have to have chosen extra language packs installed on our elgg based site's for this to work in tandem, can you clarify for me how true / comprehensive the packs are.

    I fear not being multi lingual myself lol and my foreign language users ending up been sworn at, belittled or anything remotely negative like that by having uncomplete or wrongly translated packs installed?

    @ Malaga - Let me know how you get on with your experience of this plugin, it's certainly one I require and can appreciate totally the benefit of it once installed auto picking an elgg based site's language and enabling that user with preferred language other than English, to peruse our whole site(s) with thie preferred language.

     

  • Hello Rob (@ecoshare) -- there are so many different language packs and not a central repository so it is hard to know their accuracy.  I think the Elgg Translation group maybe able to answer your question better: http://community.elgg.org/pg/groups/991/translation

     

  • Wow, as for 16 hours this plugin has a huge amount of downloads. Is this a bug? -_^

    Btw, very usefull plugin.

  • @Rob, you can check here

    Also, I think it could be usefull for this plugin to create an extension for topbar that shows for not-logged users only. It could allow to choose the language in case the plugin chose the language not as you wanted (example - you installed english version of Windows, but you are in a non-english language country, or you simply went to a different country for a trip).

  • @vazco -- thanks for the idea!  I'm not sure where I would I put a language selection though, since some themes get rid of the toolbar when users are not logged in (mine does). Hmmm... maybe I could give admins the option of an index page widget, a toolbar icon or both. :) What do you think?

  • @ Gabriel, thanks for the pointer to the group mentioned, I will bring up my thought / concern before adding the plugin and see how it pans out. As my site will be predominently business 2 business based conncetions, that is why I have to look thoroughly in to any potential issues once it's up and running etc.

    If I hear the right noises from the mentioned group, I will definitely install this great plugin or maybe work out in that group what can be trusted in the language packs (which country one etc) and do a slow release / burn every 2 months for e.g. when complete and trusted packs are added to the language packs for elgg downloads. In effect slowly adding new countries as and when everything fits and allows. and protecting myself at the sametime from irate users lol.

    @ vazco, good idea, I had already seen your topbar plugin before coming back to this discussion, so it would definitely fit in with the ideas you're mentioning of how these two could work together side by side.

    Again anything that can be used from current plugins I have installed or looking to install, that takes away the pain of either having to take weeks to try and learn how to hard code desired changes myself and provide better features and experience for my users or being able to bypass that kind of pain has got to be a massive plus. :)

    Regards,

  • @ Gabriel, further Q for your plugin. For e.g. once we have this installed and say our site's default language is set to English. Then a user ONLY see's my site in English, unless they have their browser set to a different language, that is installed in my elgg language section.

    In effect it translates on the fly?

    I ask as whilst I want to be able to offer overseas foreign language or UK based foreign langage speakers to access my site in their native language, I don't want english speaking persons which will always be the dafault main language, to come to the site and find half of it full of non readable foreign language content?

    I am just asking to make sure I understand it's workings fully before going any further and it's still a great plugin you've built regardless of my queries. :)

  • @ Vazco -

    "I think it could be usefull for this plugin to create an extension for topbar that shows for not-logged users only. It could allow to choose the language"

    This could solve another problem possibly by mixing this plugin with your topbar plugin. I would be looking for the ability to setup totally seperate "Mirror" site's, that have ALL the same features, plugins, systems as the english default site I Am working on at present.

    This may then stop my site possibly getting over run in it's default english language, with foreign language content that non luingist's like myself and no doubt many others would struggle to cope with that kind of content, thus it would impact upon my site's core users *english language* and possibly turn them off from my site.

    Just a thought in addition to my query just now to Gabriel above.

  • @Rob -- yes, this plug-in will translate on the fly.  Let's say your site's default language is English, but you also have installed a German language pack.  Now, let's say you have a visitor from Germany who speaks only German, and whos browser's preferred language is set to German.  When he comes to your site, this plug-in will detect that his browser prefers German, and will use the German language pack instead of English.  So as far as he knows, your site is in German, not English.

    Of course, this doesn't solve the issue of having user content in both languages. What your second one refers to could be solved by having separate sites, each with a different subdomain and their own default languages (e.g., fr.yoursite.com would use French, and sp.yoursite.com would use Spanish).  You really wouldn't need any plug-ins for that.

    Hope that helps.

  • @ Gabriel - Thank you for the reply, much appreciated. I understand it enough in my mind to know I definitely will use this plugin but I can only do so once I get positive feedback from the Translation group hopefully that I posted to yesterday, I'll just wait and see what that groups thought's are on the accuracy of language packs.

    Regarding subdomain's for individual countries, I understand that as the best way too now. I am sure it would just be a case of copying ALL of my english default based elgg site and all files, in to new folders that become the sub domain foreign language versions and upload with your plugin and the relevant language file and voila... all will be sweet. :)

    If I can't do it now as the language packs aren't quite accurate, at the very least I now know how to go about it in the future when it can all be brought together. :)

    Regards,

  • @Gabriel Monge-Franco thanks for this plugin!

    I have the russian pack set up and everyone thinks it's great!

    I hardcoded a few items that I now need to figure out how to get translated using your plugin! but the site is 70% all good with the russian language pack inside your plugin's language folder!

    Thanks!

  • I've installed the plugin, activate it and change the languages.php en / engine / lib, but I do not puglin is working, what's going on?
  • @brooklyntam -- you're welcome. :)  Thanks for the Russian language pack by the way.

    @derocox -- the plug-in will only work *if* you have language packs installed.  Make sure you download and install the appropriate language packs from here: http://community.elgg.org/mod/plugins/world.php?plugin_type=languagepack

  • @gabriel

    If someone produced a plugin with all the language packs in it could you modify automagic translation to use it? Or would it be better to produce installable folders that could be installed into the automagic plugin folder that it could use?

  • nope ;-)

    AutoMagic uses the standard Elgg language files => therefore these have to be inside there. Gabriel has - to put into simple terms - modified the languages.php to do a browser language detect and automatically select that language's files. Hmmm maybe some might want to volunteer to consolidate all the available language packs into one downloadable zip ;;;-O go ahead Jed I dare you ;-) LOL

  • It would be great to see all the language files in one place!  However, just throwing them into one big file might not be the best solution, since a developer might change his language file (e.g., add new phrases) when he releases a new plug-in.

    What I would love to do -- and you guys are more than welcome to throw in some ideas -- is to have a central repository where plug-in developers can keep their language files.  Since all language files are in one repository, we could create a simple download button to grab the latest language files in the repository.  By modifying a few things in languages.php, we could allow importing that file very easily (specially if we make it XML).

    Elgg doesn't seem opposed to the idea.  In fact, this is the way it used to work prior to version 1.x.... but people moved away from that for some reason.  But if anyone is willing to collaborate with me on creating this central repository for language packs, I'll be more than happy to get started right away!

     

    You can contact me via:  http://gabriel.mongefranco.com

     

  • @gabriel

    What are the .po files they download the translations in???

Gabriel Monge-Franco

Gabriel Monge-Franco is an open source developer, hacker, poet, musician and robotics experimenter.

Stats

  • Category: Uncategorized
  • License: GNU General Public License (GPL) version 3
  • Updated: 2014-11-17
  • Downloads: 2145
  • Recommendations: 0

Other Projects

View Gabriel Monge-Franco's plugins