- Posts: 2
COMMUNITY FORUM
K2 extra fields dans un site multi-langue
- Anne Perroud
- Topic Author
- Offline
- New Member
Less
More
5 years 11 months ago #170816
by Anne Perroud
K2 extra fields dans un site multi-langue was created by Anne Perroud
J'ai un site en 3 langues, avec K2 et des extra-fields.
J'aimerais que les libellés des champs additionnels apparaissent dans la bonne langue.
Par exemple, j'ai un champ intitulé Type de publication, avec les valeurs suivantes
Argument
Article publié
Chapitre de livre
Conférence
Discours d'ouverture
Discours de fermeture
Intervention
Livre
Note de lecture
Publication électronique
Synthèse
Texte préparatoire
Thèse
J'aimerais que dans la version italienne le nom du champ et les valeurs apparaissent en italien.
Est-ce possible sans installer Falang ?
Merci de votre réponse.
J'aimerais que les libellés des champs additionnels apparaissent dans la bonne langue.
Par exemple, j'ai un champ intitulé Type de publication, avec les valeurs suivantes
Argument
Article publié
Chapitre de livre
Conférence
Discours d'ouverture
Discours de fermeture
Intervention
Livre
Note de lecture
Publication électronique
Synthèse
Texte préparatoire
Thèse
J'aimerais que dans la version italienne le nom du champ et les valeurs apparaissent en italien.
Est-ce possible sans installer Falang ?
Merci de votre réponse.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6220
5 years 11 months ago #170823
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 extra fields dans un site multi-langue
K2 extra fields don't support translating content to other languages at the moment.
There is a trick though you can do.
Create a different set of extra fields for each language. One for each language.
When you assign all these items into an extra field group, they will get loaded in the K2 item form (whose content CAN be translated and assigned to different languages). Then, all you have to do is simply fill in the extra fields of the respective language. E.g. if you're writing the Italian content, fill in the extra fields with Italian labels on them, not the French ones.
Finally, modify the foreach loop where extra fields are rendered, in order to hide empty values. So in item.php, change this (around line 253):
to this:
Done.
There is a trick though you can do.
Create a different set of extra fields for each language. One for each language.
When you assign all these items into an extra field group, they will get loaded in the K2 item form (whose content CAN be translated and assigned to different languages). Then, all you have to do is simply fill in the extra fields of the respective language. E.g. if you're writing the Italian content, fill in the extra fields with Italian labels on them, not the French ones.
Finally, modify the foreach loop where extra fields are rendered, in order to hide empty values. So in item.php, change this (around line 253):
<?php foreach ($this->item->extra_fields as $key => $extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?> alias<?php echo ucfirst($extraField->alias); ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
to this:
<?php foreach ($this->item->extra_fields as $key => $extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?> alias<?php echo ucfirst($extraField->alias); ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<?php if (!empty(trim($extraField->value))): /* Show extra fields with values only! */ ?>
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
Done.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Anne Perroud
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
5 years 11 months ago - 5 years 11 months ago #170831
by Anne Perroud
Replied by Anne Perroud on topic K2 extra fields dans un site multi-langue
This does not reply to my needs, but thanks for your quick answer.
Last edit: 5 years 11 months ago by Anne Perroud.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6220
5 years 11 months ago #170836
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 extra fields dans un site multi-langue
Of course it does. Different set of extra fields for each language. Can't get any simpler. These are static data either way.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.