Alpha DevCon 2018
Results 1 to 16 of 16

Thread: 1 only Languages txt files

  1. #1
    Member Cristiano's Avatar
    Real Name
    Cristiano
    Join Date
    Jan 2007
    Location
    Venice (Italy)
    Posts
    384

    Default 1 only Languages txt files

    Hi,


    I would like to have an implementation that use only one external file txt for laguage

    Thank you
    Cristiano
    cristianodona@gmail.com

    Skype: cris-do

  2. #2
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Knoxville, TN
    Posts
    1,254

    Default Re: 1 only Languages txt files

    That would be amazing.

  3. #3
    Moderator
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,516

    Default Re: 1 only Languages txt files

    Can you explain? I think Alpha can already do what you want.

    I'm guessing a bit at what you mean here: You can maintain a single external text file that contains all your language translations, and then just feed it to the grids as an override.

    Or maybe I don't understand what you want?
    -Steve


  4. #4
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Knoxville, TN
    Posts
    1,254

    Default Re: 1 only Languages txt files

    I'd love to know how to do this--can't speak for Cristiano, but I'm just trying to avoid having to enter the definitions in every grid.

  5. #5
    Moderator
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,516

    Default Re: 1 only Languages txt files

    I sell a tool to help with this. Whether you use mine, or build your own, here's an overview of how I go about it:

    http://www.workings.com/language_mgr_overview.swf
    -Steve


  6. #6
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Knoxville, TN
    Posts
    1,254

    Default Re: 1 only Languages txt files

    Steve, I've looked at this some a few times since you posted--thanks for that. How does this work with a Tabbed UI? Where do you put the override, and is it still one place or does the override have to be on all a5w pages...?

  7. #7
    Member Cristiano's Avatar
    Real Name
    Cristiano
    Join Date
    Jan 2007
    Location
    Venice (Italy)
    Posts
    384

    Default Re: 1 only Languages txt files

    Hu Guys,

    Sorry Steve, But I do not never received your first post, just the christappan post. Let me explain.
    With Alpha five I need to make for every grid my laguages definition . If we could use an external text file for each grid , and just call these language definitions If I write the code on my grid <a5:r> Lastname</a5:r> With alpha five I need to replicate all my definition languages for all my grid.
    If I use a db( like your sample or and external txt file with all language definitions I think is more easy
    Cristiano
    cristianodona@gmail.com

    Skype: cris-do

  8. #8
    Member Cristiano's Avatar
    Real Name
    Cristiano
    Join Date
    Jan 2007
    Location
    Venice (Italy)
    Posts
    384

    Default Re: 1 only Languages txt files

    Hi Steve,

    If I wanted to translate some words on a web pages , not inside a web componet I can use the same the tags <a:r5></a:r5> and this translation where I need to insert ? If I using an external txt file ( or db) with all my translations it would be more easy
    Cristiano
    cristianodona@gmail.com

    Skype: cris-do

  9. #9
    Moderator
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,516

    Default Re: 1 only Languages txt files

    The tags only work in the grid. They may be adding them for other components in V11 - I don't know - but you'd need some A5 component to do the job. I suppose you could write an Xbasic function that did this on a page. But instead of doing this, it might be easier to just convert your page into a grid configured to look like "just a page" and let the A5 engine do the work.
    -Steve


  10. #10
    Member Cristiano's Avatar
    Real Name
    Cristiano
    Join Date
    Jan 2007
    Location
    Venice (Italy)
    Posts
    384

    Default Re: 1 only Languages txt files

    Ok, Thank you Steve. I have in mind to try to make an external file with all my definition languages , but it might be easy convert the page , but I don't know convert . how I do that ?
    Cristiano
    cristianodona@gmail.com

    Skype: cris-do

  11. #11
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Knoxville, TN
    Posts
    1,254

    Default Re: 1 only Languages txt files

    How does this work with Tabbed UIs? The grids called from Tabbed UI buttons are part of of the Tabbed UI page but aren't changed by my attempts, e.g.:

    language.a5w:
    Code:
    <%a5
    dim pageVar as p
    pageVar.lang = "<a5:r>ISC</a5:r>=\"CM\""
    %>
    then in the Tabbed UI Properties "User defined 'head' content":
    Code:
    <%a5
    a5w_include("Language.a5w")
    
    tmpl.override_settings = <<%override_settings%
    	languageDefinition = pageVar.lang
    %override_settings%
    %>
    It's not changing the word ISC to CM on a language-tagged frame label in the Tabbed UI menu nor the language-tagged HTML in the components opened from the Tabbed UI. Am I still missing something?

  12. #12
    Member Cristiano's Avatar
    Real Name
    Cristiano
    Join Date
    Jan 2007
    Location
    Venice (Italy)
    Posts
    384

    Default Re: 1 only Languages txt files

    Thank you Christappan
    Cristiano
    cristianodona@gmail.com

    Skype: cris-do

  13. #13
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Knoxville, TN
    Posts
    1,254

    Default Re: 1 only Languages txt files

    Did you figure it out Cristiano? I got most of what I wrote in my post from Steve's video link above, but it's NOT working on Tabbed UIs... still trying...

  14. #14
    Member Cristiano's Avatar
    Real Name
    Cristiano
    Join Date
    Jan 2007
    Location
    Venice (Italy)
    Posts
    384

    Default Re: 1 only Languages txt files

    I think yes, I just need studying better the video
    Cristiano
    cristianodona@gmail.com

    Skype: cris-do

  15. #15
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Knoxville, TN
    Posts
    1,254

    Default Re: 1 only Languages txt files

    Thanks to others on the board, Steve's video, and some other snippets, we finally figured this one out, so I thought we'd share this for anyone else who can find all the pieces but not the whole thing like us...

    We created a SQL table with the following form:

    Code:
    ID | Lang_ID | Def      | Val
    1  |    1    | Customer | Customer
    2  |    2    | Customer | Client
    3  |    2    | Company  | Business
    4  |    1    | Company  | Company
    The Lang_ID is what defines what language you're using, the Def column is the string in <a5:r></a5:r> tags throughout your application, and the Val is what will appear to the user.

    We set the session.__protected__language just after login--you may be able to use something else--but it's a numeric value based on the language setting for that user.

    Then we're using the following code in the OnGridInitialize Event of each grid (we actually put this in a function for greater ease, but the point is that the final value is the e.tmpl.languageDefinition):

    Code:
    	
    dim language as c
    dim cn as sql::connection
    dim sqlCommand as c
    dim args as sql::arguments
    dim rs as sql::ResultSet
    	
    args.add("Lang_ID",session.__protected__language)
    cn.open("::Name::SQL Server Express")
    cn.execute("SELECT def,val FROM language_definition WHERE languageID = :Lang_ID",args)
    rs = cn.ResultSet
    
    WHILE rs.nextRow()
    	language = language + "<a5:r>" + rs.data("def") +"</a5:r>=\"" + rs.data("val") + \""+crlf()
    END WHILE
    
    e.tmpl.languageDefinition = language
    Assuming a session.__protected__language value of 2, this ends up like this:
    Code:
    e.tmpl.languageDefinition = <a5:r>Customer</a5:r>="Client"
    <a5:r>Company</a5:r>="Business"
    ...and that changes all the text in <a5:r></a5:r> tags to whatever is in the tables. You don't have to do the language definitions at the grid level--just one place in your tables. And this is structured for an infinite number of languages as long as you make sure there's a def and val for each tagged string for each language.
    Last edited by christappan; 06-15-2011 at 10:53 PM. Reason: languageDefinition (not activeLanguage)

  16. #16
    Member Cristiano's Avatar
    Real Name
    Cristiano
    Join Date
    Jan 2007
    Location
    Venice (Italy)
    Posts
    384

    Default Re: 1 only Languages txt files

    Thank you christappan,
    This is exactly what I designed. We are in full agreement, even though we are thousands of miles away.

    regards
    Cristiano
    cristianodona@gmail.com

    Skype: cris-do

Similar Threads

  1. Import .txt files from different location and name
    By g8tor96 in forum Alpha Five Version 8
    Replies: 4
    Last Post: 10-30-2007, 11:31 AM
  2. Editing txt or csv export files
    By Raymond Lyons in forum Alpha Five Version 7
    Replies: 11
    Last Post: 12-08-2006, 12:05 PM
  3. Importing txt files
    By Richard Kern in forum Alpha Five Version 5
    Replies: 1
    Last Post: 04-15-2003, 10:10 AM
  4. Creating DOC, WRI or TXT files
    By Martin in forum Alpha Five Version 4
    Replies: 6
    Last Post: 03-06-2003, 11:57 PM
  5. Need to print .txt files when button is pressed
    By David Smothers in forum Alpha Five Version 4
    Replies: 4
    Last Post: 04-30-2000, 08:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •