Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7838305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:03:53+00:00 2026-06-02T15:03:53+00:00

I’m working on an existing multi-language site (Coldfusion/MySQL). Why is it that on a

  • 0

I’m working on an existing multi-language site (Coldfusion/MySQL).

Why is it that on a lot of pages I’m sitting on, some text strings are always hard-coded into the markup like:

 <CFIF language = "EN"><p>Hello World</p></CFIF>

while others use the database to update text like so:

 <p><cfoutput>#tx_greetings#</cfoutput></p>

What is the best practice here? I thought if I’m going to use a database for translations, it would be easier to store all texts in there (long and small). If I’m not using a database, then all texts should be if-elsed. Mixing it is a little maintenance-heavy, isn’t it?

Also, is there a limit on text-string-length, which I’m storing to MySQL? Maybe performance-wise?

Thanks for some inputs!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:03:55+00:00Added an answer on June 2, 2026 at 3:03 pm

    You shouldn’t store strings/translations in your code, that’s bad practice if you want a maintainable i18n’d site.

    You should store all your string in the same location, db or a properties file per language. It doesn’t matter which, but be consistent. Personally I prefer a properties file as its easy to edit.

    welcome_message=Hi {0}, Welcome to my site
    

    Load all your translations in one go in onApplicationStart(), then provide a wrapper class to access them and to format the string with supplied arguments

    for example

    #i18n.getString(user.getLocale(), "welcome_message", [user.getUsername()])#
    

    You can use java.text.MessageFormat[1] to provide powerful formatting

    function getString(string locale, string key, array args) {
      var mf = createobject("java", "java.text.MessageFormat");
      mf.init(variables.strings[arguments.locale][arguments.key]);
      return mf.format(javacast("java.lang.Object[]", args));
    }
    

    The above is just an example, and you need to provide error catching and caching to this

    Hope that helps point you in a productive direction

    [1] http://docs.oracle.com/javase/7/docs/api/index.html?java/text/MessageFormat.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.