How to localize crop screen of react-native-image-crop-picker for Android?

1.2k views Asked by At

For iOS we have 2 props cropperChooseText and cropperCancelText to localize these buttons inside Crop screen

ImagePicker.openPicker({
  cropperChooseText: 'any text...', //ios only
  cropperCancelText: 'any text...', //ios only
})

and we can add languages to localizate the camera / gallery / cropper text buttons:

  • Open your Xcode project
  • Go to your project settings by opening the project name on the Navigation (left side)
  • Select your project in the project list
  • Should be into the Info tab and add in Localizations the language your app was missing throughout the +
  • Rebuild and you should now have your app camera and gallery with the classic ios text in the language you added.

But how to localize Crop screen on Android?

1

There are 1 answers

0
Stich On

To achieve localization for Android I have added next files:

[YOUR_PROJECT_NAME]/android/app/src/main/res/values-ua/strings.xml [YOUR_PROJECT_NAME]/android/app/src/main/res/values-ru/strings.xml [YOUR_PROJECT_NAME]/android/app/src/main/res/values-[2 symbol country code]/strings.xml

with the following content (this is for UA language):

<resources>
    <string name="ucrop_label_edit_photo">Виберіть область</string>
    <string name="ucrop_crop">Обрізати</string>
    <string name="ucrop_rotate">Повернути</string>
    <string name="ucrop_scale">Масштаб</string>
    <string name="ucrop_label_original">Ориг.</string>
</resources>

Then you need to rebuild the app.

My version of "react-native-image-crop-picker" is "^0.35.1"