Results 1 to 4 of 4
  1. #1
    sisva18 is offline Novice
    Windows 10 Office 365
    Join Date
    Aug 2021
    Posts
    7

    Handeling multiple languages

    Hi

    I will try to explain myself since I cant show the code due to been work related.
    By having multiple tables supporting different languages with primary keys matching in each table.


    I have created a way that the user can switch language. But I wonder how I could optimize this.
    I found myself creating a classmodule where I have set the labels of the individual forms calling it from the form by instatiating an object of the class.
    Instead of creating a function in each of the forms where I set the labels I now just call the object for better readability?
    Although I still find myself writing a bit redundant code by assigning these boxes/textfield I guess there is no way around it?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    The way I handle languages is to have an admin table along the lines of

    PK
    Phrase
    LanguageFK
    Translation

    Then I have a function in a standard module that accepts the form object and languageFK as optional parameters

    the function

    1. only runs if the language is not the development language
    2. creates a static recordset of the records for the specified language if not already created so this normally run when the db is first opened or user logs in
    3. then loops through the form for captions and finds matches in the recordset for the caption and updates the form and control captions accordingly


    There are other translation functions to handle things like messages (gets complicated when the message is dynamic!) and a developer option to identify captions without a translation


    So I use a standard module rather than a class module.

  3. #3
    sisva18 is offline Novice
    Windows 10 Office 365
    Join Date
    Aug 2021
    Posts
    7
    Quote Originally Posted by Ajax View Post
    The way I handle languages is to have an admin table along the lines of

    PK
    Phrase
    LanguageFK
    Translation

    Then I have a function in a standard module that accepts the form object and languageFK as optional parameters

    the function

    1. only runs if the language is not the development language
    2. creates a static recordset of the records for the specified language if not already created so this normally run when the db is first opened or user logs in
    3. then loops through the form for captions and finds matches in the recordset for the caption and updates the form and control captions accordingly


    There are other translation functions to handle things like messages (gets complicated when the message is dynamic!) and a developer option to identify captions without a translation


    So I use a standard module rather than a class module.

    Okay I understand where you are heading but I am actually quite new into access/vba developement. I just wonder if it is considered bad practice to use class module over modules to do these repetetive tasks I come from a more OOP background and like the concepts which class modules offer.

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    For something like this I don’t think it really matters- whatever works for you. I also come from a OOP background and tend to use classes for specific objects rather than a general function

    Forms are objects and their modules are class modules so my view is any form that wants to share a common functionality would call a general function.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Handeling If null
    By Homegrownandy in forum Queries
    Replies: 14
    Last Post: 01-10-2017, 09:43 AM
  2. Query handeling empty FK keys
    By warlock916 in forum Access
    Replies: 1
    Last Post: 01-12-2016, 07:18 AM
  3. Handeling Multipule Units of Measure
    By Waldenbound in forum Database Design
    Replies: 1
    Last Post: 09-02-2011, 08:24 AM
  4. Decimal seperator between different languages
    By seshan in forum Programming
    Replies: 3
    Last Post: 01-31-2010, 03:03 PM
  5. Please help w/ simple languages db
    By TalentNation.net in forum Database Design
    Replies: 0
    Last Post: 01-23-2009, 09:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums