我对多语言实现迷失了。怎么处理呢?会话、Cookie、文件……其他方式?
概述
网站是一个用户内容网站,就像社交网络一样。我们将拥有由我们控制的系统内容和由用户翻译的用户内容。支持的语言将由系统控制。首先将列出最受支持的 20 种语言。有两种用户类型(非用户和登录用户)。两种用户类型都有页面,因为并非所有页面都需要登录。非用户仍然可以查看许多公共页面或公开的个人资料页面。
要求
-
我想直接访问法语的公共页面(作为示例),而不必访问英语网站,然后将语言更改为法语。 (可选)
-
对于用户内容 ->如果我想将英语内容翻译成意大利语,我只想翻译该 1 个内容(示例状态更新)而不是整个页面。所以页面是英文的,但我可以为该内容输入意大利语,而无需将整个页面转换为意大利语。
-
从一处根据语言搜索内容。如果我正在阅读评论,我只想从菜单中加载德语评论,而不更改其他页面内容。
-
我想查看所有德语版的墙上帖子,我可以通过更改语言直接从我的个人资料中执行此操作,还是必须注销该语言会话并使用新语言的新会话登录(如果会话)基于?
-
我希望能够更改任何页面上任何内容的语言,而无需用户登录或注销。
- 我需要根据语言类型执行内部分析。 (例如网络 X 发布中文内容的人员的墙贴数量。因此我需要跟踪每个内容的每种语言。)
其他
我仍然不确定内容是数据库驱动还是文件驱动,但首先我正在研究如何最好地处理多语言以实现可扩展性,同时保持用户友好。
建议?
I am lost on multi-language implementation. How to handle it? Session, Cookies, File, ...other ways?
Overview
Website is a user content website, like a social network. We will have system content controlled by us and user content translated by users. Languages supported will be system controlled. To start there will be the top 20 supported languages. There are two user types (Non-user and logged-in user). Both user types have pages as not all pages are behind a log-in. Non users can still view many public pages or profile pages that are public.
Requirement
-
I want to access a public page in French (as an example) directly without having to hit the site in english then change the language to french. (optional)
-
For user content -> If I want to translate an English content to Italian, I am looking to translate only that 1 content (example status update) not the entire page. So page is in English but I can input Italian for that one content without converting the entire page into Italian.
-
Search for content based on language from one place. If I am reading reviews, I want to load only German reviews from the menu but not change other page content.
-
I want to view all wall posts that are in German, can I do it straight from my profile by changing the language or do I have to logout of that language session and login with a new session for the new language, if session based?
-
I am seeking to be able to change language on any page, for any content without having the user to login or logout.
- I need to perform analytics for internal purposes based on language type. (like number of wall posts by people by network X who posted content in Chinese. So I will need to track per language per content.)
Other
I am still not sure if the content will be database or file driven but first I am looking into how I can best handle multi-language for scalability yet keep it user friendly.
Suggestions?
发布评论
评论(1)
这个问题可能没有得到回答,因为常见问题解答的这一部分:“你的问题应该有合理的范围。如果你能想象一整本书来回答你的问题,那么你问得太多了。”
https://stackoverflow.com/faq
翻译引擎+搜索引擎+用户引擎+分析引擎?尝试一次学习并实施一项。我会回答这个问题,以防万一有人看到这个并且仍然感兴趣,但我也不是这个领域的专家,所以我会列出我所做的和所想的。
1、创建语言引擎。到目前为止,一个简单的“语言”下拉菜单应该足够了(对于访问者来说),数据库、cookies、会话和代码都正确完成。按照你喜欢的方式创建它,你列出的内容相当复杂,但完全可以实现。
2、添加用户引擎,包括数据库、登录/注销表单、代码和所需的一切,并将它们放在一起。每个用户都需要在“用户”表中有一列包含他们的首选语言。稍微修改语言引擎以支持用户。现在这一定很容易实施。
第三,(对我来说仍然是新鲜事),创建搜索引擎。
4、实施分析引擎。我建议使用外部的,因为它更容易和完整。
但是,如上所述,这只是我的意见。
This was probably not answered because of this section of the faq: "Your questions should be reasonably scoped. If you can imagine an entire book that answers your question, you’re asking too much."
https://stackoverflow.com/faq
Translation engine+search engine+user engine+analytics engine? Try learning and implementing one at a time. I'm going to answer it just in case someone sees this and is still interested, but I'm not an expert in this area neither, so I'll list what I did and think.
1st, create the language engine. A simple "Language" drop-down menu somewhere should be enough so far (for the visitors) with the database, cookies, session and code correctly done. Create it as you like it, what you listed is rather complex but perfectly achievable.
2nd, add the user engine, including database, log in/log out forms, code and everything needed and put both of them together. Each user needs to have a column in the "user" table with their preferred language. Modify slightly the language engine to support users. This must be easy to implement now.
3rd, (and still new for me), create the search engine.
4th, implement the analytics engine. I'd recommend using an external one, since it's much easier and complete.
But, as stated, this is just my opinion.