If you are talking about the content, then yes this is normally stored in
the database and is handled by a CMS system. You would then have a separate
version of the content for each language, and load the appropriate version
depending on which language the logged in user has chosen.
If you are are referring to the language of the site, menus, interface etc,
then this really comes down more to preference, some folks use XML/JSON,
some store in a database.
Personally I would store it in the database, because form there you can
easily generate both XML and JSON anyway plus you have ability to easily
save revisions whenever something is edited and roll back if required.
The reason a lot of apps use a flat file is because it allows the community
to then produce language files for the project.
What you can then do is create a TERM in English and store the various
other language equivalents.
e.g.
Table: TermRefs
TermRefID (primary key):
Reference (varchar)
Table TERMS
TermID (primary key):
TermRefID (foreign key):
Term (varchar):
LanguageID (foreign key)
Table: Languages
LanguageId (primary key)
Language (varchar)
DisplayText (varchar)
sample data
==========
TERMREFS
1 ContactMenuText
2 ProductsMenuText
3 SupportMenuText
LANGUAGES
1 English
2 French
3 German
TERMS
1 1 "Contact Us" 1
2 1 "contactez-nous" 2
3 1 "kontaktieren Sie uns" 3
You would only need to query this lot once and then cache it and use QofQ
of get your references, so no load on database.
The TermRefs.reference is a simple understandable reference that you would
use to contain the text and output it on to the site.
e.g.
<a href="contactus.cfm">#getterm("ContactMenuText")#</a>
You would use the LANGUAGES table on your site in a dropdown list or
whatever to give the user the language selector. Most people tend to put
this in English, which must be annoying for the non English visitors, thus
the "DisplayText" field, so you can actually display the Language names in
that language.
HTH
On Tue, Oct 2, 2012 at 10:01 AM, Edward Chanter <[email protected]> wrote:
>
> We're about to embark on a project for which locallisation is a requirement
> and it's the first time I've done this. I understand the basic concepts
> about having data containing the words and phrases needed on a website
> stored with versions for each language but I'm trying to figure something
> out: what's the best way to store the data?
>
> I see a lot of sites using flat JSON/XML/Whatever files with the different
> translations but is this something that would work well coming from a
> database? Is it more efficient to use a flat file or simply have a database
> store the words and phrases in columns with a new row for each language?
> One advantage I can see with a database option is that it makes adding new
> languages a little easier for people with no access to the file system on
> the server. It could also be managed with web forms which seems easier than
> having a massive flat file with loads of XML or JSON data structures.
>
> The purpose of this question is to see how you all do it and whether there
> are any pit-falls I should watch out for?
>
> Thanks ;-)
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352797
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm