Jump to content

(Noob) Lifecycle of a multi-language configuration parameter/variable (new lang-system)


Recommended Posts

So I'm pretty sure I know how to implement translation possibilities for quite every class, controller, template file, twig. But what I have not been able to find an answer to yet, not even via AI, is how the lifecycle of a multi language-capable configuration variable exactly is.

What I mean is:

Let's say we have some sort of title-variable that we want to save via modules configuration page. So it's a configuration variable that should be multi language. So a different title-value can be set for each language. When we enter a value for all three languages and press save button inside the module configuration, the title gets saved in all languages by the getContent/postProcess function that handles the saving/updating part. 

I know for normal config vars i can just in the install() method "declare"/"initialize" them like this:
Configuration::updateValue('title', 'Blubb')

But how do I do that with a config var that should be saved in three languages? Looks like I have to use ps_configuration_lang, but there seems to be no information on how that works. Also how would the helperForms form then look like for the title? is "lang" => true in the helperForms form declaration, enough? and also how would the part of the getContent/PostProcess function that saves the values look?

Would anyone maybe even be able to provide a skeleton project? Or somehow list the whole way for the variable from "initialization" to "saving/updating" in all languages. I'm really lost here, tried it all, no info on this nowhere. I'm only interested in the latest language system that got introduced with 1.7.8.6 I think... The old $this->l() system is of no interest.

 

MANY thanks for anyone who could contribute :)

Link to comment
Share on other sites

 @JBW Yes!! Thanks so much. Next to Youtube, AI, Prestashop Docs, amm, I was looking through all possible modules and the configuration table but wasn't able to find an example. Funny that exactly the banner module which I activated last week in my shops is gonna help me out here :'D

I was able to take all necessities from that module and now my shop feedback module is taking shape. Thank you very much for pointing me towards it, it's perfect, my values are getting saved, everything works properly :)

Edited by psy_ch (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...