Andreas:
Not sure if this would be helpful.
We have released a cookie life-cycle manager that handles all the getting consent and setting cookies parts so you don’t make mistakes.
It has examples for behavior, localized in a few languages, and open source.