This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello, I am developing a plugin that integrates with an external CRM and enables automatic page generation from database records. I have an issue while figuring out the translation scheme for this plugin.
This is my current flow:
- Save values from an external XML to local DB
- Get values from DB and create new page for each seperate array object
- Display these values on the front-end.
Lets say I want to display the estate's type of this object. I would use this code:
{{ realEstate.type|raw }}
This field can populate one of the three possible values in the database.
Value 1,
Value 2,
or Value 3
I am using the translation plugin and I would like to process this value and display it in another language with the Translate plugin.
So when I am using Slovene instead of English,
{{ realEstate.type|raw }}
becomes Vrednost 1 instead of Value 1.
I have this so far. How can I solve this on the backend, so I can just output realEstate.type without long if sentences everytime
{% if realEstate.type == "1" %}
{{ 'Prodam'|_ }}
{% elseif realEstate.type == "2" %}
{{ 'Kupim'|_ }}
{% endif %}
Last updated
1-1 of 1