I need a structure that can automatically define permission descriptions for localize that xcode supports when building with cordova via Meteor. I am open to your suggestions.
Description:
In our Meteor project, we are getting the mobile build with cordova. And we need certain permissions for ios build. For these, this addition has been made in mobile-config.js
:
App.appendToConfig(`
<platform name="ios">
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>We use your location information to make it easier for you to select your service area.</string>
</edit-config>
<edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge">
<string>We use it to save the files you download from the application.</string>
</edit-config>
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>We use your camera during image and video sending.</string>
</edit-config>
<edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
<string>We use your microphone to send voice recordings.</string>
</edit-config>
</platform>
`)
But as you can see the descriptions here are in English and I want to define them with 4 different language codes as en,tr,ar,fr. In order to display the appropriate description according to the user’s phone language.
What I tried to do this:
1- I tried to add different language codes by doing appendToConfig
but I guess I was not successful because there is no such usage on cordova side.
2- In my research I saw that cordova-plugin-localization-strings - npm plugin is used for this localization. I added this cordova plugin to the project. But as a requirement. Creating a translations/app
folder in the root directory of the cordova-build folder and language files such as en.json,tr.json,en.json,ar.json,fr.json
for each language.
I couldn’t find a structure that moves this folder from meteor during the build phase into cordova-build in meteor.
I tried App.addResourceFile('')
but it moves it to resource-file
folder but I need to move it to root directory.
{
"config_ios": {
"NSLocationWhenInUseUsageDescription": "We use your location information to make it easier for you to select your service area.",
"NSPhotoLibraryAddUsageDescription": "We use it to save the files you download from the application.",
"NSCameraUsageDescription": "We use your camera during image and video sending.",
"NSMicrophoneUsageDescription": "We use your microphone to send voice recordings."
}
}
App.addResourceFile('translations/app/en.json', 'translations/app')
App.addResourceFile('translations/app/tr.json', 'translations/app')
I tried to set the moved folder to the plugin but that didn’t work either.
App.appendToConfig(`
<plugin name="cordova-plugin-localization-strings" spec="~5.0.5">
<variable name="TRANSLATION_PATH" value="/resource-files/Users/username/Repos/Test/meteor-blaze-cordova-test/translations/app" />
</plugin>
`)
When I manually move the translations folder, I can see the variables on x-code but it does not change the descriptions for the relevant permissions.