Translator for website [closed]
Asked Answered
O

6

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 .

Orangy answered 15/4, 2013 at 7:33 Comment(9)
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 translatorKimberly
Google "I18N" for more information on what NullPointer is talking about.Indifference
@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. :)Superjacent
@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).Gentoo
@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 :)Superjacent
Interesting. Makes sense.Gentoo
@David One word: gettext. Specialized for translations, caches translations in memory. Much better than databases.Charisecharisma
@Charisecharisma what language or framework is gettext from?Gentoo
@David It's a GNU project adapted for virtually all popular languages. gnu.org/software/gettextCharisecharisma
M
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.

Messiaen answered 21/9, 2013 at 9:58 Comment(0)
G
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
Gridiron answered 15/4, 2013 at 14:18 Comment(0)
Q
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.

Quest answered 18/4, 2013 at 3:39 Comment(0)
S
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.

Smallscale answered 2/8, 2013 at 12:40 Comment(0)
J
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)
}
Joachima answered 13/9, 2013 at 13:31 Comment(0)
L
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).

Lockjaw answered 22/2, 2014 at 19:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.