Code: Select all
{def x = audio.language.findResults{ it.toLocale() }.unique().join(' '); x.replaceAll('es', 'es-419'); if (x) "audio $x"}
However, I would like for an exception to be made in case 2 or more Spanish audio tracks exist, so that it would add es-es (stands for Spanish Spain) along with es-419
so the sample output would be something like: es-419 es-es en (not necessarily in that order).
I was considering the creation of a variable that could detect that case, so that it could serve as a condition to use x.replaceAll('es', 'es-419') or x.replaceAll('es', 'es-419 es-es');
That's where I'm stuck. I welcome any suggestions.