mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Extended NSBundle localizations method for Android.
This commit is contained in:
parent
ca76053c8e
commit
409030a367
2 changed files with 23 additions and 8 deletions
12
ChangeLog
12
ChangeLog
|
@ -6,11 +6,13 @@
|
|||
* Headers/Foundation/NSBundle.h:
|
||||
* Source/NSBundle.m:
|
||||
Added methods for passing Android asset manager from Java to GNUstep
|
||||
and for getting AAsset/AAssetDir for given path in main bundle. Skip
|
||||
app bundle suffix check on Android. Extended bundle resource paths
|
||||
backbone to check for known paths directly on Android as we can't
|
||||
enumerate directories. Extracted path cache cleaning into separate
|
||||
method.
|
||||
and for getting AAsset/AAssetDir for given path in main bundle.
|
||||
Skip app bundle suffix check on Android. Extended bundle resource
|
||||
paths backbone to check for known paths directly on Android as we
|
||||
can't enumerate directories.
|
||||
Extended -localizations method to check for known localizations
|
||||
directly (requires setting userLanguages in NSUserDefaults).
|
||||
Extracted path cache cleaning into separate method.
|
||||
* Source/GSFileHandle.h:
|
||||
* Source/GSFileHandle.m:
|
||||
Added file handle support for reading Android assets from main bundle.
|
||||
|
|
|
@ -2540,10 +2540,23 @@ IF_NO_GC(
|
|||
locale = [[locale lastPathComponent] stringByDeletingPathExtension];
|
||||
[array addObject: locale];
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
// TODO: check known languages for existance directly, as AAssetDir and thereby
|
||||
// NSDirectoryEnumerator doesn't list directories
|
||||
#endif
|
||||
// Android: Check known languages for localizations directly, as AAssetDir
|
||||
// and thereby NSDirectoryEnumerator doesn't list directories and the above
|
||||
// call to list lproj resources will therefore come up empty.
|
||||
NSArray *languages = [[NSUserDefaults standardUserDefaults]
|
||||
stringArrayForKey: @"NSLanguages"];
|
||||
|
||||
for (locale in languages) {
|
||||
NSString *path = [self pathForResource:@"Localizable" ofType:@"strings"
|
||||
inDirectory:nil forLocalization:locale];
|
||||
if (path) {
|
||||
[array addObject: locale];
|
||||
}
|
||||
}
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
return GS_IMMUTABLE(array);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue