Giter Site home page Giter Site logo

Multiple language support? about ponzu HOT 10 OPEN

ponzu-cms avatar ponzu-cms commented on May 1, 2024 5
Multiple language support?

from ponzu.

Comments (10)

nilslice avatar nilslice commented on May 1, 2024 1

Hi @paultyng -

Sorry for the delay in response.. I wanted to give this enough thought to offer some actionable feedback for you or anyone who might want to work on this feature. Lately, I've just been swamped with a client project that is about to launch.

I would imagine this could be best achieved through a new system package for i18n, containing a Translateable interface which when implemented would do a few things:

  1. have a method to define the languages supported, which would in turn create a new bucket for each language, like MyType__translated__zh_CN, MyType__translated__en_US (if English is not the primary input language). This would look something like:
func (m *MyType) Translations() map[string]string{} {
        return map[string]string{
                "zh_CN": "Chinese (Simplified)", 
                "en_US": "English (US)", 
        }
}
  1. create and register new API endpoints to return or add/edit a translation, i.e. /api/content/translated & /api/contents/translated which would mirror the various actions of /api/content but instead of changing or retrieving data in the main content buckets, it would do so on the bucket dictated by some query param in the URL.. for example, /api/content/translated?type=MyType&id=3&lang=zn_CN would return the results for a call to db.Content("MyType__translated_zn_CN:3"). Maybe these routes are registered in the init func, so they're only activated if this package is imported somewhere.

  2. define some UI toggle in that would appear in the Editor or Manager for the MyType inside the CMS, which would return the same UI as seen currently, but would set some query param to tell the DB which language bucket to pull content from or to set content in. This would be similar to how the editor.Mergeable/api.Createable interfaces impact the UI.

I'm sure I am missing some details, but I think this could be done without too much impact on the existing design.

from ponzu.

nilslice avatar nilslice commented on May 1, 2024 1

@martinsotirov -

The bucket structure would be better suited to have the translations a sibling bucket rather than a child. The reason being, all of the Content APIs and Database APIs rely on this for fast lookups, and tend to favor quick iteration through a bucket to find a key.

The separation of these buckets would allow us to continue this pattern and choose a different language very easily just by issuing a param name to append to the DB lookup. See the system/db package, particularly content.go to see what I mean.

from ponzu.

mordillo123 avatar mordillo123 commented on May 1, 2024 1

Hi all, no any updates about this request feature?
Best regards!

from ponzu.

olliephillips avatar olliephillips commented on May 1, 2024 1

Hey @mordillo123 thanks for your question. The issue's labelled "help wanted" so remains on the radar, but like all open source, time resource is constrained. With this issue also, there are particular skills/experience re i18n needed, which is why - I would guess - there's been no movement.

from ponzu.

nilslice avatar nilslice commented on May 1, 2024

Hi @paultyng -

I haven't really put much thought into i18n specifically for content (added to the CMS by a user). I think the first step for any i18n would be for the hard-coded names for things in the CMS itself, like navigation, section titles, buttons etc.

My experience in this area is fairly limited, so any suggestions you have would be fantastic to hear. I currently don't have a plan for this.

I'm not sure there would be an elegant way to do i18n for the content a consumer ends up adding though, at least not in a way that would be 'automated' (i.e. generating a sibling field for adding content in different languages)

What do you think?

from ponzu.

paultyng avatar paultyng commented on May 1, 2024

Adding it to the UI I think makes sense, and would be relatively straightforward with some of the existing libraries. Below are some of my basic thoughts on the adding it to the consumer system, but I'm not sure its worth it, mainly I was curious if it was on your roadmap in the first place.

In some internationalized systems I work with now, when a person creates/edits content in their language, its submitted for translation to some third party SaaS queue that handles managing translators and all that and then gets fed back in automatically when translated via like a webhook, although asynchronously and attached to the original record as an additional version of it. Occasionally though the consumer knows multiple languages and can edit them both in real time in the UI. One of the weird things is that the titles (and slugs) can change between languages and so forth, so it may just not make sense to add on to this system, I'm not sure as it would probably quite significantly affect the architecture.

If anything I could see changing the localizable fields to a new type that is something like map[LanguageTag]string for "translatable" resources / fields. And then you just need the ability to specify the requested languages (typically a coalescing structure, of like chosen language, accepted languages, app default language) values when requesting it in the api (so you don't just return all languages to consumers unnecessarily).

from ponzu.

joeblew99 avatar joeblew99 commented on May 1, 2024

awesome that this is being looked at...
The ponzu API for i18n looks like a good start.

Here is a golang lib for it. i did a fair bit of i18n and there is a huge amount to it once you dog deeper, so its important to choose your weapons well :)

https://github.com/corestoreio/csfw/tree/master/i18n

  • Has brought all the golang libs into one and covered ALL aspects for i18n
  • covers both text, but also numbers, currency and RTL / LTR.

from ponzu.

martinsotirov avatar martinsotirov commented on May 1, 2024

i18n is really important for ponzu to be viable CMS, I think.

I'm not a BoltDB expert but can't we have each content type have a root bucket and then sub-buckets for each language?

from ponzu.

torniker avatar torniker commented on May 1, 2024

I'll try to tackle this.

I'll create translation branch and do the work there. @nilslice If you'll have some time please review the code from time to time.

I'll post updates here so I wouldn't do something out of scope or make some breaking changes.

Wish me luck :)
Cheers

from ponzu.

nilslice avatar nilslice commented on May 1, 2024

Thanks, @torniker - just a heads up, with the CI broken, we're not in a good spot to accept PRs. I'd ask that any incoming code include some cleanup of the CI so that the project is tested and built upon each PR. Once the CI is fixed, I'm happy to look through PRs.

Also, that is just my opinion, but the project is now under the ownership of apilayer.com via @julian-zehetmayr - who may have a more flexible policy on CI.

from ponzu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.