How to override command on my preamble, after its redefinition by my class with renewcommand?

I use this document class abntex2 from: https://ctan.org/pkg/abntex2?lang=en, but when I generate this:

\documentclass[12pt]{abntex2}

\renewcommand{\listfigurename}{Lista de Figuras}

\begin{document}

\listoffigures*

\end{document}


The list of figures name is not overwritten by Lista de Figuras, it still Lista de Ilustrações:

It only works if I put \renewcommand{\listfigurename}{Lista de Figuras} inside the document like this:

\documentclass[12pt]{abntex2}

\begin{document}

\renewcommand{\listfigurename}{Lista de Figuras}
\listoffigures*

\end{document}


Why I cannot override it?

Looking at the abntex2 code, I see they redefine the command:

  \renewcommand{\listfigurename}{Lista de ilustra\c{c}\~{o}es}


How to override the \listfigurename on my preamble, after the abntex class inclusion?

Extra

If someone is wondering how I switch between English and Portuguese this is how:

\documentclass[12pt]{abntex2}
\usepackage[utf8]{inputenc}
\newif\ifenglish\englishfalse

% \englishtrue
\newcommand{\lang}[2]{\ifenglish#1\else#2\fi}

\ifenglish
\PassOptionsToPackage{language=english}{biblatex}
\PassOptionsToPackage{brazil,main=english,spanish,french}{babel}
\else
\PassOptionsToPackage{language=brazil}{biblatex}
\PassOptionsToPackage{main=brazil,english,spanish,french}{babel}
\fi

\begin{document}

\section{\lang{English Section}{Seção em Português}}

\lang{Section contents.}{Conteúdo da seção.}

\end{document}


Which generates the following PDF in Portuguese:

If I uncomment the \englishtrue, then, the generated PDF document will be in English as follows:

• Which language do you use, do you use babel? Apr 1, 2019 at 4:24
• Probably you want: \addto\captionsbrazil{\renewcommand{\listfigurename}{My List}}. Apr 1, 2019 at 4:36
• I use english and portuguese for babel with \newcommand{\lang}[2]{\ifenglish#1\else#2\fi}: Is it possible to keep my translation together with original text? - I added this \addto\captionsbrazil on my preamble and it worked.
– user
Apr 2, 2019 at 0:54

\PassOptionsToPackage{brazil,main=english,spanish,french}{babel}


is that it comes to late. At that moment babel was already loaded without that options you need. You need to move the following line above \documentclass{abntex2}

\PassOptionsToPackage{brazil,english}{babel} % ,spanish,french <========


Please see that I deleted spanish and french not used in the mwe and I deletes main=. We change language later with command

\selectlanguage{english}


To show that the code given below works with biblatex too I added an citing and printing of a small bibliography ...

With the complete MWE:

\PassOptionsToPackage{brazil,english}{babel} % ,spanish,french <========
\documentclass[12pt]{abntex2}

\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{graphicx}

\newif\ifenglish\englishfalse

%\englishtrue
\newcommand{\lang}[2]{\ifenglish#1\else#2\fi}

\ifenglish
\usepackage[language=english]{biblatex}
\selectlanguage{english} % <==========================================
\else
\usepackage[language=brazil]{biblatex}
\selectlanguage{brazil} % <===========================================
\fi

\begin{document}

\listoffigures*

\section{\lang{English Section}{Seção em Português}}
\begin{figure}[htbp]
\centering
\includegraphics[width=5cm]{example-image-a}
\caption{test}
\label{fig:example-image-a}
\end{figure}

\lang{Section contents.}{Conteúdo da seção.}

\begin{figure}[htbp]
\centering
\includegraphics[width=5cm]{example-image-b}
\caption{test b}
\label{fig:example-image-b}
\end{figure}

\cite{knuth:ct,companion}
\printbibliography

\end{document}


gives us the result:

and bibliography

If you want to change the usual used titles/names by babel please have a look to this anwer. It shows how you can for example change the brazil name for \listfigurename:

\addto\captionsbrazil{%
\renewcommand{\listfigurename}{Lista de ilustra\c{c}\~{o}es}%
}