6

I am develeping a website in 2 languages.

one option is We can do own translation but that can take more development time.

So i'm trying to find a plugin.

I tried Microsoft Translator Widget and google translate gadget but both are not working for full website. user has to choose their language on each page in the website. Any other plugins are there to translate entire site. I read so many threads like link1 link2 . noting helped me.

Please suggest .

Community
  • 1
  • 1
S B
  • 1,363
  • 12
  • 21
  • 6
    only better way to do is write in both language differently and store in database and store chooses language in cookie and show content according to cookie ... and there is not any good translator – NullPoiиteя Apr 15 '13 at 07:37
  • 2
    Google "I18N" for more information on what NullPointer is talking about. – Adrian May 08 '13 at 16:26
  • 2
    @NullPoiиteя > A better option would be to store the strings for each language in a separate file and include the appropriate one according to the option selected by the user. This option is better because database queries more take time, and you would be transferring a larger amount of data. `:)` – rktcool Sep 07 '13 at 07:33
  • 1
    @rktcool, I'm no expert, but I've heard many people and sources I respect encourage using databases for large amounts of data or more speed. A good indication is the popularity of LAMP (Linux, Apache, *MYSQL*, Perl) for websites. Wordpress, for example, uses MySQL to store posts. A database must be set up correctly to take advantage of the gains it can provide, but once you do so, it's much faster than reading from the file system. It's also required for storing input from users (like all these stackoverflow questions, answers, comments, and votes). – David Winiecki Oct 18 '13 at 01:32
  • @David, I am sorry for digging up so old a post, but I just saw that I ran off mid-conversation. `:)` What you say might be true, but you have to consider the possibility that the databases are hosted on another server, and not your own LAMP. Free hosting providers do this all the time, if I am not mistaken. In such a case, the overhead in reading from your filesystem will be _significantly_ less than reading from a database which is on another server `:)` – rktcool Dec 27 '13 at 11:16
  • Interesting. Makes sense. – David Winiecki Dec 27 '13 at 16:46
  • @David One word: gettext. Specialized for translations, caches translations in memory. Much better than databases. – deceze Feb 22 '14 at 19:59
  • @deceze what language or framework is gettext from? – David Winiecki Feb 25 '14 at 03:20
  • @David It's a GNU project adapted for virtually all popular languages. http://www.gnu.org/software/gettext/ – deceze Feb 25 '14 at 06:31

6 Answers6

1

All you can do is store a cookie or session as the language preference of the user when user first enters the website.
You can then use the same session on each page to automatically call the google translate engine for the particular language based on the language variable in your session.
You can do this in a seprate .php file and can include it in all your webpages.
Hope it helps. Thanks.

Dev Utkarsh
  • 1,377
  • 2
  • 18
  • 43
0

I have an example of the Google Translate pluggin posted at http://learnwithecho.com/. If you install this on each page of the site it will continue to work throughout. You can confirm this by checking the cookie is loaded. However, if your content spans multiple sites, try something like this:

  • User visits siteA.com/index
    • Chooses alternate language
    • Javascript on this page detects cookie and loads siteB.com/setLang.php?lang=LANG
  • User loads siteB.com/setLang.php
    • Return content type application/javascript
    • Set a cookie on siteB to store that language
  • User follows a link from siteA to siteB
    • The user brings the cookie you made and Google Translate kicks in after the page loads
William Entriken
  • 37,208
  • 23
  • 149
  • 195
0

The Microsoft Translator widget persists the user's selection across pages on the same site, so from that point of view it does effectively translate the entire site.

If the site is spread across different domains (for example using iFrames), it will be a bit more difficult.

Laurence Moroney
  • 1,263
  • 8
  • 20
0

Better that you can use CMS (content management system). In CMS they providing language translation facility. You can translate what language you want. It will translate your content automatically.

Tomato cms is one of the best for your solution... It is open source CMS.

CJ Ramki
  • 2,620
  • 3
  • 25
  • 47
0

If you're using an OS or OTS CMS, there's likely to be built in language support. If you're building something yourself and you have the time to do your own language translations, you could use Google Translate or Microsoft Translate to build your translation file.

Null has a good comment, this just expands more:

Joomla & PHPBB have good examples of language implementations.

JText::_('COM_SOMETHING_BLAH_TITLE');

to code your own:

  1. Create language files

language.en

language.es

  1. In each language file add the same lines:

(en) MESSAGE_SOMETHING="Something" (es) MESSAGE_SOMETHING="Algo"

  1. Create a class or function to print out language text:

    print translate('MESSAGE_SOMETHING', 'es');

and your translate function could be something like

function translate ($label, $lang) {
$language = load_and_populate_language($lang);
$translated = $language[$label];
return (if $translated is empty, '', else $translated)
}
Justin Mitchell
  • 665
  • 6
  • 13
0

Just a suggestion but perhaps you'd find it useful to provide the translations yourself and then have a client-side language translator? I wrote this plugin for exactly that purpose because the quality of automatic translations is not up to the level I wanted.

https://github.com/coolbloke1324/jquery-lang-js

That plugin has language persistence across pages, allows both phrase and regex-based matching, can handle any number of language options and allows you to trigger the change from a click event as you described.

You can see it being used live on https://www.orbzu.com (look top-left of the page for the flag icon and then select a new language to see the text on the page change automatically).

Rob Evans
  • 6,750
  • 4
  • 39
  • 56