#1 2024-05-24 11:01:25

flydev
Member
From: France
Registered: 2020-11-27
Posts: 59
Website

MVC - multilingual and image(s)

Hi there,

My first question is what would be the most optimized way to implement a multilingual setup based on mvc-blog example?


My second question is about images, I was just wondering how are you used to handle image(s) in post on your side?

On my side, I have deployed a standalone imgproxy server; An user can then insert in HTML content code a shortcode, for example `{{img="/blurred/image1.jpg" alt="..."}}` (`blurred` is a preset and handled by imgproxy).
Once the article is saved, a new folder is created using article's ID as folder name - eg. `/.static/images/{{ID}}` - and the image is uploaded into this folder - as the image server point to `/.static/images`, he can then handle images variations, cache and serve webp images along some custom presets. Everything works very good and there is not impact, SEO practices at 100%.

Thanks smile

Offline

#2 2024-05-24 11:37:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,492
Website

Re: MVC - multilingual and image(s)

About multi-lingual MVC Web, there is no included / automated implementation of i18n yet.

Perhaps the easy way is
- start with a working English (or main language) set of view html files,
- maintain a set of additional per-language view html files, each in its sub-folder,
- re-route the page views at HTTP server level to access the main (English) interface methods,
- use {{"English text}} pattern and OnStringTranslate whenever needed.

About images, you may try to implement it using a custom route at HTTP server level. It is easy to redirect POST requests to a specific method.

Offline

#3 2024-05-24 13:18:46

flydev
Member
From: France
Registered: 2020-11-27
Posts: 59
Website

Re: MVC - multilingual and image(s)

Okay, I'll start experimenting with this workflow.

Regarding images, I wanted to know how others do it, like storing images as a blob or other techniques, but after my post, I think that in my case this would definitely not be the way to go. As for the redirection, perhaps I could use it to trigger an initial request to generate the images before a user even visits the page, and thus save a few ms. I hadn't thought of that.

Thanks for your insight @ab

Offline

#4 2024-06-22 18:23:56

flydev
Member
From: France
Registered: 2020-11-27
Posts: 59
Website

Re: MVC - multilingual and image(s)

I made an experiment to get an i18n implementation working for windows. As it is working and found it helpful, I published it on on github along a vcl and mvc-blog examples (require PUREMORMOT2).

Last edited by flydev (2024-06-22 18:26:16)

Offline

#5 2024-06-23 10:39:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,492
Website

Re: MVC - multilingual and image(s)

This is great!

I need to include an official i18n unit to the repository.
We will look into it.

Thanks a lot for the interest and feedback!

Offline

#6 2024-06-27 19:39:40

flydev
Member
From: France
Registered: 2020-11-27
Posts: 59
Website

Re: MVC - multilingual and image(s)

Just pushed an update for people interested to see an example of the mvc app using automatic translation based on the msg reference files. Every user, guest or logged, can set his own language kept in cookie session.

ps: I am not claiming it's the right way of doing it as it seem ugly to create and free a changed language on render.

It can be compiled on lazarus. Anyway, the feature is really cool for an hybrid desktop app.

Last edited by flydev (2024-06-27 19:42:30)

Offline

Board footer

Powered by FluxBB