0

I have a custom user profile edit twig file.How can i check current language code in user twig file in drupal8?

0

1 Answer 1

0

You can check language in twig as below:

{% if (language.getId() == 'en') %}
    Do something
{% endif %}
8
  • Thanks for the answer.I have tried this in my file.But this is not working.
    – salu
    Commented Aug 3, 2018 at 10:17
  • Which version of D8?
    – Ajay Reddy
    Commented Aug 3, 2018 at 10:24
  • @salu – What do you mean by "this is not working". Try to fix your issue strategically. So what does {{ language.getId() }} return you then? Did you flush your caches?
    – leymannx
    Commented Aug 3, 2018 at 10:26
  • @Ajay Reddy:Am working with 8.53.
    – salu
    Commented Aug 3, 2018 at 11:33
  • @leymannx:I have flushed the caches and no result get from {{ language.getId() }}
    – salu
    Commented Aug 3, 2018 at 11:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.