PATH_LOCALE is the base path for the locale files, each locale is in a sub directory like:
fr/LC_TIME
fr/..
en/LC...
So you need sub directories, and iOS bundles do not support sub directories.
When you do
setlocale(LC_CTYPE,"en_US.UTF-8");
The C library looks for a directory called "en_US.UTF-8" in PATH_LOCALE.
The solution I found is to add the locales in the bundle as a zip (with the whole sub directory structure), unzip it at first launch in the documents path and set PATH_LOCALE to that new directory.
NSString* documentsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
NSString* localeDir = [documentsPath stringByAppendingPathComponent:@"/locale"];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:localeDir];
if (!fileExists) {
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"locale" ofType:@"zip"];
ZipArchive *zipArchive = [[ZipArchive alloc] init];
[zipArchive UnzipOpenFile:filepath];
[zipArchive UnzipFileTo:documentsPath overWrite:YES];
[zipArchive UnzipCloseFile];
}
setenv("PATH_LOCALE", [[NSString stringWithFormat:@"%@/locale", documentsPath] cString], 1);
This uses Ziparchive that you have to include in your project.
https://code.google.com/archive/p/ziparchive/