Multi-lingual site

Coordinator
Jan 14 at 6:01 PM
Anyone here made a website with aVFP of course and has a built in multi-lingual options on it? I know that I can use google translate but I'm looking at another options if anyone have done it.
Coordinator
Jan 19 at 6:07 PM
http://stevenblack.com/intl/

Expensive and I don't know anything about it other than it's been around a while. But it's an alternative. (I actually like your google translate idea)

Here's something I googled:
http://www.websitebuilderexpert.com/how-to-build-a-multi-language-website/
Coordinator
Jan 19 at 9:47 PM
I don't think stevenblack tool can do this, but you gave me an idea to play around with it. I used this tool before and as far as I know it only works with forms and reports. I tried it with google translate but I wanted more of a professional look where I can maintain a translation table dictionary so the wordings will not be so "goofy" as google translate it as is.
Coordinator
Jan 20 at 8:08 PM
Edited Jan 20 at 8:10 PM
It happens that I am just finishing a project with AVFP & JQuery Mobile, that implied multi-language support (French / English). For this I created a little JS utility that handle all the localization tasks. For example:
jl.setLang("ES-ca");   // The language ES-ca is definied in a file called ES-CA.js
jl.Localize();   // This will localize automatically any HTML element 
                 //  with a data-langid attribute in it:
                 //  <button data-langid="buttons.save">Save</button>)
Also, you can manually get the current localization for any string easily:
var save = jl.get("buttons.save");
Now, this works only for browser-side localization.


Victor
Coordinator
Jan 20 at 8:20 PM
Edited Jan 20 at 8:20 PM
Victor, this is specifically what I wanted to achieve. Do you maintain a table for translating from original EN to FR? At the moment I only need the browser-side localization as well.
Coordinator
Jan 20 at 11:11 PM
I maintain a separate js file for each supported languages. This files are loaded during the main page load and they add a language to the jl component. Take a look of one of this language files:
/*
    jlang Language File
    
    Canadian English
*/

jl.addLang({

  id: "EN-ca",
  index: 2,
  caption: "English",
  content: {

    // Common strings
    common: {

        pleaseLogIn: "Please log in",
        table: "Table",
        tables: "Tables",
        seat: "Seat",
        seats: "Seats",
        order: "Order",
        error: "Error",
        empty: "Empty",
        current: "Current",
        select: "Select",
        with: "With",
        replace: "Replace",
        replaceWith: "Replace with",
        putInside: "PUT INSIDE",
        none: "None",
        max: "max",
        warning: "Warning",

        buttons: {
            back: "Back",
            cancel: "Cancel",
            dismiss: "Dismiss",
            confirm: "Confirm",
            discard: "Discard",
            send: "Send",
            save: "Save",
            delete: "Delete",
            print: "Print",
            continue: "Continue"              
        }

    },
    
As I said, the component works at two levels:
  1. It can localise any DOM element, by using a data attribute called "langid"
  2. It can return any specific localised string by using the jl.get() method.
If you are interested, write me on private.

Victor
Feb 18 at 3:17 PM
I have a text file (one for language) that contains string_name and string_value for all my objects or messages of my website. I made a simple function that load the right translation based on selected language stored in a session variable. Works fine but it is only for label, not for text content loaded dinamically...
Coordinator
Feb 20 at 12:19 AM
My lib has the advantage of being able to call the Localize() method every time you want, in order to localize again the whole DOM or just an element and its contents.

Victor