How to use iOS device settings for language in Ionic 5 / Cordova

How do set language for context menus (select all, cut, copy, paste…), file upload, camera dialogues and other iOS or plugin functionality that is outside of your core project?

The answer is CFBundleDevelopmentRegion set in info.plist

It seems CFBundleDevelopmentRegion is always set to en_US by default (or maybe this is because I build on a laptop that has these settings) thus showing context menus, file upload dialog etc in English.

I found that setting CFBundleDevelopmentRegion to empty uses device settings for language.

It seems making the change directly in Xcode does not work for some reason.

Put this in your config.xml ios section.

<platform name="ios">
   <config-file parent="CFBundleDevelopmentRegion" target="*-Info.plist">
        <array>
            <string />
        </array>
    </config-file>
</platform>

Note that some plugins seem to set language, so if you cannot get this to work, check your plugins. This was tested in Ionic 5 / Angular / Cordova.

Thanks to Maximillion Bartango on SO for putting me on the right track.

Please comment if this worked for you or if you have problems or other solutions.

Leave a comment

Your email address will not be published. Required fields are marked *