# Creating language package options

This is essentially the same question: Write a class with language dependent strings. But I didn't find any solutions that worked.

I'm trying to create a package where languages are package options, like so:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mypackage}[2019]
\RequirePackage[utf8]{inputenc}
\RequirePackage{babel}

\DeclareOption{nynorsk}{
\PassOptionToPackage{main=nynorsk}{babel}
%\AtEndOfClass{\main@language{nynorsk}}
}        % Gir pakken med nynorsk babel
\DeclareOption{bokmål}{
\PassOptionToPackage{main=norsk}{babel}
%\AtEndOfClass{\main@language{norsk}}
}           % Gir pakken med bokmål babel
\DeclareOption{english}{
\PassOptionToPackage{main=english}{babel}
%\AtEndOfClass{\main@language{english}}
}         % Gives the package with english babel
\DeclareOption*{\PackageWarning{examplepackage}{Unknown ‘\CurrentOption’}} % for unknown input
\ProcessOptions\relax
\endinput


In a document it would look something like this:

\documentclass{article}
\usepackage[english]{mypackage}

\beging{document}
Hello, this is a document
\end{document}


I get this error on the line \usepackage[english]{mypackage} in the document:

LaTeX Error: Unknown option english' for package mypackage*. Missing
= inserted for \infum. Missing numer,treated as zero.


and on the line with \begindocument I get this error:

LaTeX error: \RequirePackage or \LoadClass in Options section


So how can I create a multilingual package with language options?

edit: What I try to do is including the babel package in mypackage such that I can write:

\usepackage[english]{mypackage}


\usepakckage{mypackage}
\usepackage[english]{babel}


Package options cannot be applied after the package has been loaded, so move \RequirePackage{babel} at the end.
And third, the name is \PassOptionsToPackage (note the “s”).
• Although package options can’t in general be applied after a package is loaded, in this specific case, \babelprovide can load a language. – Davislor Oct 17 at 22:12