Get namespace number by namespace name.
Nirvanchik opened this issue · 1 comments
Nirvanchik commented
I use a service to fetch some Wiki data and get namespace name of the pages as a String.
To implement my bot logic I want to convert this string to an integer id, which is unique and easy to use in code.
But Wiki.java doesn't have anything to do this except
public int namespace(String title) throws IOException
I need:
public int namespaceId(String namespace) { namespaces.get(namespace); }
Also, the next method has a weird titling.
public String namespaceIdentifier(int namespace) throws IOException
// int namespace - THIS IS ID actually!
It's better to rename it to namespaceName(int id)
//@return the identifier of the namespace
->
@return the namespace name (localized)
MER-C commented
Does wiki.getNamespaces().get(namespace)
solve this problem?