Error with \RequirePackage in a class file

I am trying to use the command \RequirePackage[spanish,es-tabla]{babel} in my own class (i.e, my .cls file) but the following error occurs:

Command \labelenumi already defined.

A temporary solution that I found is use the command \RequirePackage[spanish,english,es-tabla]{babel}, but this produces changes in the titles of the ToC, LoF and LoT, because I changed with

\addto\captionsspanish{
\renewcommand{\contentsname}%
{\center\normalsize\MakeUppercase{contenido}}%
}
\renewcommand{\listfigurename}%
{\center\normalsize\MakeUppercase{lista de figuras}}%
}
\renewcommand{\listtablename}%
{\center\normalsize\MakeUppercase{lista de tablas}}%
}


There is some solution?

Edit: A mwe of myclass.cls and test.tex

myclass.cls

\NeedsTeXFormat{LaTeX2e}[2017/04/15]
\ProvidesClass{myclass}[2018/06/09 Standard LaTeX document class]
\let\labelenumi\relax
\RequirePackage[spanish,es-tabla]{babel}
... %here the code is the same of the book class
\ExecuteOptions{letterpaper,10pt,twoside,onecolumn,final,openright}
\ProcessOptions
... %here the code is the same of the book class
\endinput


test.tex

\documentclass{myclass}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
... % other packages

\renewcommand{\contentsname}%
{\center\normalsize\MakeUppercase{contenido}}%
}
\renewcommand{\listfigurename}%
{\center\normalsize\MakeUppercase{lista de figuras}}%
}
\renewcommand{\listtablename}%
{\center\normalsize\MakeUppercase{lista de tablas}}%
}

\begin{document}

\end{document}


Edit: It works with

myclass.cls

\NeedsTeXFormat{LaTeX2e}[2017/04/15]
\ProvidesClass{myclass}[2018/06/09 Standard LaTeX document class]
... %here the code is the same of the book class
\ExecuteOptions{letterpaper,10pt,twoside,onecolumn,final,openright}
\ProcessOptions
... %here the code is the same of the book class
\RequirePackage[spanish,es-tabla]{babel}
\addto\captionsspanish{% Replace "english" with the language you use
\renewcommand{\contentsname}%
{\center\normalsize\MakeUppercase{contenido}}%
}
\renewcommand{\listfigurename}%
{\center\normalsize\MakeUppercase{lista de figuras}}%
}
\renewcommand{\listtablename}%
{\center\normalsize\MakeUppercase{lista de tablas}}%
}
\endinput

• a command \let\labelenumi\relax just before your call to babel could do the trick... – koleygr Sep 17 '18 at 23:34
• thanks for answering. I tried your suggestion: \ExecuteOptions{letterpaper,10pt,twoside,onecolumn,final,openright} \ProcessOptions \let\labelenumi\relax \RequirePackage[spanish,es-tabla]{babel} but the error is the same – Joan Sep 17 '18 at 23:48
• Can you please add a mwe with filecontents? – koleygr Sep 17 '18 at 23:54
• I'll try, I'm still a little newbie... – Joan Sep 18 '18 at 0:06
• Try \RequirePackage[spanish,es-tabla]{babel} just before \endinput in your cls. Edit: Sorry but worked on a wrong example.. You edited in between... – koleygr Sep 18 '18 at 0:50

You have to call \RequirePackage[spanish,es-tabla]{babel} just before the \endinput command of your .cls file.
\RequirePackage is usually called in .sty files (in packages more general). Packages has to be called after \documentclass... And thus, packages (like babel here) will take care of previous defined commands, but documentclass has no reason to do it and has no checks about it.