Post

Replies

Boosts

Views

Activity

Reply to Programmatic way to find the language of an application
Hi @eskimo, it seems this solution Bundle.main gets you application bundle. preferredLocalizations is a list of languages your application bundle supports in user-preferred order. The first element will be the language your application is running in. is not working as expected, is returning English everytime because English is the first element, even if application language is French, for example. Here is the source code, could you please take a look at it? Not sure if we are doing something wrong or there is something wrong in the CoreFoundation side. Many thanks for your help! CFArrayRef cfAllLanguages = CFBundleCopyBundleLocalizations(cfBundle) CFArrayRef cfPrefLang = CFBundleCopyPreferredLocalizationsFromArray(cfAllLanguages); --- this should return language of the application but it returns En each time CFArrayRef cfLocalPrefLang = CFBundleCopyLocalizationsForPreferences(cfAllLanguages,cfPrefLang); CFArrayRef cfDefaultLang = CFBundleCopyLocalizationsForPreferences(cfAllLanguages,NULL); CFStringRef lss = (CFStringRef)CFArrayGetValueAtIndex(cfAllLanguages, 0); Thank you!
Topic: Programming Languages SubTopic: General Tags:
Apr ’22
Reply to Programmatic way to find the language of an application
Hi @eskimo, thank you for your help, is now clear to us! Have a good day!
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Programmatic way to find the language of an application
Hi @eskimo, it seems this solution Bundle.main gets you application bundle. preferredLocalizations is a list of languages your application bundle supports in user-preferred order. The first element will be the language your application is running in. is not working as expected, is returning English everytime because English is the first element, even if application language is French, for example. Here is the source code, could you please take a look at it? Not sure if we are doing something wrong or there is something wrong in the CoreFoundation side. Many thanks for your help! CFArrayRef cfAllLanguages = CFBundleCopyBundleLocalizations(cfBundle) CFArrayRef cfPrefLang = CFBundleCopyPreferredLocalizationsFromArray(cfAllLanguages); --- this should return language of the application but it returns En each time CFArrayRef cfLocalPrefLang = CFBundleCopyLocalizationsForPreferences(cfAllLanguages,cfPrefLang); CFArrayRef cfDefaultLang = CFBundleCopyLocalizationsForPreferences(cfAllLanguages,NULL); CFStringRef lss = (CFStringRef)CFArrayGetValueAtIndex(cfAllLanguages, 0); Thank you!
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Programmatic way to find the language of an application
I see, thank you @eskimo for the help!
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Programmatic way to find the language of an application
Thank you, guys, for your answers. @eskimo we are running an application and we would like to know the language of another application, independent of our application. This application might be running or not. We are targeting Apple x64 machines, both ARM64 and Intel processors.
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22