473,662 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multi-languages website : problem of architecture

Hi,

I am building a multi languages website. To simplify let's say that I need
to deal with news, projects, partners, all of them having some information
depending on the language (title, introduction, ...) and some not depending
on the language (date_online, date_offline, published, ...). The main point
is that I don't want to have to touch the structure of the database or to
modify my scripts if one or more languages were to be added. I came up with
something like this :

My architecture:
----------------------------------------------------------------------------
------
'news' table: with all information not depending on the language
news_id (primary key)
date_online
date_offline
published
...
'news_translati ons' table: with all information depending on the language
news_id (primary key)
lang (primary key)
title
introduction
...
The (news_id, lang) is linking the second table to the first one.

Same kind of structure for all other content that needs to be translated
(projects, partners, etc.).
Is there a better approach: something using only one table with all the
information that has to be translated, coming from any table (news,
projects, partners, etc.) ? or something else ?

Thank you,

BLob
Jan 12 '06 #1
3 1679
BLob schrieb:
Hi,

I am building a multi languages website. To simplify let's say that I need
to deal with news, projects, partners, all of them having some information
depending on the language (title, introduction, ...) and some not depending
on the language (date_online, date_offline, published, ...). The main point
is that I don't want to have to touch the structure of the database or to
modify my scripts if one or more languages were to be added. I came up with
something like this :

My architecture:
----------------------------------------------------------------------------
------
'news' table: with all information not depending on the language
news_id (primary key)
date_online
date_offline
published
...
'news_translati ons' table: with all information depending on the language
news_id (primary key)
lang (primary key)
title
introduction
...
The (news_id, lang) is linking the second table to the first one.

Same kind of structure for all other content that needs to be translated
(projects, partners, etc.).
Is there a better approach: something using only one table with all the
information that has to be translated, coming from any table (news,
projects, partners, etc.) ? or something else ?


I use a table 'strings' with the fields:
- stringnumber
- language
- string

and in the 'news' table I have all the fields necessary, but all
multilanguage fields contain the stringnumber instead of the text itself.

I could not say if this approach was better than yours, it is just
different. The advantage of it is that you have access to any string
regardless of the information about what object it belongs to. This
makes it easy to make fallbacks for the case some info is not present in
the desired language, somehow like

function get_string($str _nr, $lang, $main_lang) {
$string = [get string for $lang here];
if ($string == "" || $string == NULL) {
if ($lang != $main_lang)
return get_string($str _nr, $main_lang, $min_lang);
else
return false
}
else return $string;
}

HTH
Markus
Jan 12 '06 #2
I use a table 'strings' with the fields:
- stringnumber
- language
- string
I thought about this structure, but I don't know if it is better or worse
than the one I proposed in my first post. 'string' has to be a 'text' field
in the database in order to hold both data from what would otherwise be
varchar and text. Isn't this a problem ? (I don't know).
and in the 'news' table I have all the fields necessary, but all
multilanguage fields contain the stringnumber instead of the text itself.
OK.
I could not say if this approach was better than yours, it is just
different. The advantage of it is that you have access to any string
regardless of the information about what object it belongs to. This
makes it easy to make fallbacks for the case some info is not present in
the desired language, somehow like


Yes, it makes it easier for the 'translation' process. But on the other hand
I guess it makes it more complicated to search within information (search
engine), as you don't know what type of data you have without making links
to other tables. That's why I chose the other approach, but maybe I am wrong
and there is a pretty work around do do efficient searches with the
structure you described. What do you think ?

BLob
Jan 13 '06 #3
BLob schrieb:
I use a table 'strings' with the fields:
- stringnumber
- language
- string
I thought about this structure, but I don't know if it is better or worse
than the one I proposed in my first post. 'string' has to be a 'text' field
in the database in order to hold both data from what would otherwise be
varchar and text. Isn't this a problem ? (I don't know).


According to the MySQL manual a "text" field requires as much disk space
as the size of the text it holds (plus 1 byte). That's why I think it is
not a problem to use the "text" data type also for very short strings; I
actually don't understand the reason why most developers use varchar
fields with specified string lengths. But maybe I am wrong here.
Yes, it makes it easier for the 'translation' process. But on the other hand
I guess it makes it more complicated to search within information (search
engine), as you don't know what type of data you have without making links
to other tables. That's why I chose the other approach, but maybe I am wrong
and there is a pretty work around do do efficient searches with the
structure you described. What do you think ?


I built a special search index table where I store all information for
every object that has to be searchable centrally. This is extra
programming work, but I see several advantages in it:

- As the contents of a page is centralized in one field you can use the
MySQL fulltext search and take advantage of its boolean and ranking
capabilities
- When storing the contents to the search index you can pre-process it,
for example remove punctuation and convert accented characters and
whatever, which can improve the performance and quality of the search
process
- If you need to add another type of objects - say "products" - you
don't have to edit your search process, but just add the appropriate
"store to search index" method to the "products" administration.

--
Markus
Jan 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
4876
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours, Pujo
4
4657
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
3870
by: * ProteanThread * | last post by:
but depends upon the clique: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=954drf%24oca%241%40agate.berkeley.edu&rnum=2&prev=/groups%3Fq%3D%2522cross%2Bposting%2Bversus%2Bmulti%2Bposting%2522%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den ...
0
3771
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black and white CCITT4 compressed files (frames) inside the tiff. Every now and then I receive a mixture of black and white CCITT4 and JPEG compressed files, and sometimes just multi-page tiffs with JPEG only. The code runs great when dealing with the...
6
4881
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on a table called COURSES. This table has 2 fields CATEGORY_ID, COURSE_NAME. The CATEGORY_ID is a FK in COURSES and a PK in CATEGORIES. I want to populate the course list box based on any category(s)
4
17857
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the problem is the charset? How I can avoid this warning? But the worst thing isn't the warning, but that the program doesn't work! The program execute all other operations well, but it don't print the converted letters: for example, in the string...
5
5981
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a TIFF to several PNG files this causes a problem, becuase the resulting image is (the page to the far left and a lot of black space surrounding it and a filesize that is larger than needed. Any ideas?
5
3272
by: dkelly925 | last post by:
Is there a way to add an If Statement to the following code so if data in a field equals "x" it will launch one report and if it equals "y" it would open another report. Anyone know how to modify this? Private Sub cmdPreview_Click() On Error GoTo Err_Handler 'Purpose: Open the report filtered to the items selected in the list box. 'Author: Allen J Browne, 2004. http://allenbrowne.com Dim varItem As Variant 'Selected items
17
10652
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, Wide character and multi-byte character are two popular encoding schemes on Windows. And wide character is using unicode encoding scheme. But each time I feel confused when talking with another team -- codepage -- at the same time. I am more confused when I saw sometimes we need codepage parameter for wide character conversion, and sometimes we do not need for conversion. Here are two examples,
1
9303
by: mknoll217 | last post by:
I am recieving this error from my code: The multi-part identifier "PAR.UniqueID" could not be bound. The multi-part identifier "Salary.UniqueID" could not be bound. The multi-part identifier "PAR.UniqueID" could not be bound. The multi-part identifier "PAR.PAR_Status" could not be bound. The multi-part identifier "Salary.New_Salary" could not be bound. The multi-part identifier "Salary.UniqueID" could not be bound. The multi-part...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.