文章内容来源于以下引用,因为以下链接需要才可以访问,所以特意搬过来,方便查看
https://medium.com/walkin/database-internationalization-i18n-localization-l10n-design-patterns-94ff372375c6
In this Digital Age, we always want to expand our business to different parts of the world to bring more sales thus more profits. Expanding the business to different parts of the world is not easy if your application is not localized. This is because, Different parts of the world have different languages, different metric systems, different formats of representing the data, different currencies etc. In this article, I am going to present different database design patterns for content localization.
First, let me give you a brief introduction to
Internationalization/Localization if you are not aware of them.
Internationalization(I18N) is the process of designing a software
application so that it can potentially be adapted to various languages and
regions without engineering changes
Localization(L10N) is the process of adapting internationalized software
for a specific region or language by adding locale-specific components and
translating the text.
Localization doesn’t mean content translations essentially. But supporting local
Now let’s dig into the patterns.
This is the easiest approach among all others. In this approach, we will add
a new column to the table for every field which needs to support
localization.
In all the patterns that I am going to show I will try to localize the products table.
See the below image of products table.
If you observe there are columns following column_name_languageCode.
Since products need to support the name, price, description for various languages,
So it has a column of every type for every language.
Pros:-
Cons:-
In this approach instead of making a new column for every language, We will manage data in the rows based on a column like language_code.
Sample data looks like
Pros:-
Cons:-
Note:- To centralize make a languages table and use the foreign key relationships by adding all languages etc. From now, all approaches I will follow it.
Pros:-
Cons:-
Note:-
1.You can choose the above approach with the combination of Separate columns for each field approach.
Doing so all translation will be under a single row but as we support a new language, requires altering table for adding a new translation column.
In this approach Instead of putting all translation under the same table, we will write a separate translation table for each table which requires localization.
Pros:-
These are some of the patterns I could think off. If you know any other approach please let me know in the comments section. Will be happy read them.
Hope this article is useful to you. Thanks for reading ?.