How can I access untranslated field values in a translated view row? If you add the title field to a view you can use the token title__raw as a pattern. I just created a custom field for use in view named dossier_status and I need to create something a like dossier_status__raw token. The reason is that the status can be translated to different languages but I need the status always in english to use it as a css class. How can I accomplish this?



For the moment I have another field named dossier_status_machine_name (with the status always in english) But I think that this is not the best approach.
It seems not to be possible to access untranslated field values in a rewrite token pattern for text fields. You can get the untranslated value from the field in a template by using the row entity and getting the untranslated entity {{ row._entity.getuntranslated().field_dossier_status.value|clean_class }}, but using templates in Views I would avoid if possible. So this may be a better approach:

Static

Supposed that there is a limited number of CSS classes, in most cases CSS is static, use a field field_dossier_status of the type list (text) with a allowed values list:

dossier-status-class-1| Dossier Status Class 1
dossier-status-class-2| Dossier Status Class 2
...


You can translate the second part of the allowed values in Translate content fields.

Now if you access the raw value from this list field in a Views token pattern __value you get the untranslated first part

&lt;div class="{{ field_dossier_status__value }}"&gt;


and this result:

&lt;div class="dossier-status-class-1"&gt;


Dynamic

If the CSS is dynamic you can use a dynamic method for the allowed values, see Dynamic Default and Allowed Values for List Fields in Drupal 8, which btw. gave me the initial idea for this answer to the question you asked some days ago. You could even parse the dynamic CSS for the classes it provides and fill them in the allowed values list.