Display site content in user language

eric redegeld Posted in General Discussion 7 months ago

If using OSSN:
OSSN version: 8.0
Website URL (optional): Justbsocial.eu

If facing any bug:
PHP Version :
Error Log if any:
Browser:
OS (Window/Linux/Android/iOS/Mac): vps ubuntu

Hi all,

I'm building a multilingual social network based on OSSN (Open Source Social Network), and I'm currently working on a feature that filters posts based on language preference.

I’d like to implement automatic language detection for user-generated content (such as wall posts, blog entries, comments, etc.) so that users can choose to only see content in languages they understand.

Has anyone implemented something like this before? Or are there best practices or recommended libraries (preferably PHP-based or lightweight APIs) that work well with OSSN’s structure?

A few specific questions:

Should detection happen on the client side or server side?

Are there any known OSSN hooks or best places in the codebase to inject this logic when posts are created?

Would it be better to store detected language in post metadata (e.g., OssnObject->data)?

Any experience with libraries like Text_LanguageDetect or external APIs like Google's or langdetect?

Appreciate any pointers or examples!

So no translator. User based option to display content in all, or just there own language

Thanks in advance,

Eric

Replies
Dutch Eric redegeld Replied 6 months ago

hint to the makers, would be an great asset standard option.

well i got this so far https://github.com/compie67/LanguageFeed
lets join and work together

German Markus Weber Replied 6 months ago

Hi Eric,

we’re working on something similar right now with OSSN and also trying to make a multilingual setup work. We're not experts either, but here’s what we’ve found so far:

  • Server-side detection seems to be more reliable than client-side, especially when there are a lot of posts.
  • We looked into a few lightweight PHP libraries like Text_LanguageDetec and langdetect They’re not perfect, but okay for basic detection.
  • Storing the detected language in OssnObject->data might be useful, so you can filter later without re-checking every post.
    -> Suggested using the wall/post/created hook to inject detection when a post is created — we’re still testing that, but it looks promising.