jaydeepw / poly-picker

Android library project for providing multiple image selection from the device.
406 stars 114 forks source link

How to change language/texts #37

Closed sagits closed 8 years ago

sagits commented 9 years ago

Very nice library, heres how to change texts (usefull for changing language):

public class MyImagePickerActivity extends ImagePickerActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getActionBar().getTabAt(0).setText("Camera");
    getActionBar().getTabAt(1).setText("Gallery");

    ((Button)findViewById(R.id.action_btn_cancel)).setText("Cancel");
    ((Button)findViewById(R.id.action_btn_done)).setText("Done");
    ((TextView)findViewById(R.id.selected_photos_empty)).setText("No image selected");

  }
}

By the way, can you declare all ImagePickerActivity fields protected? Whis way we can extend it and change for our needs.

jaydeepw commented 9 years ago

Okay, thanks for commenting and helping the fellow users. I will create the issue to change member field visibility.

sagits commented 9 years ago

Thank you. I Would like to be able to change the "images already selected" text, when i select a language. I have tried to import your lib as a module (so i can change it), but not been able. Can you set this text as a variable too please? Thanks in advance.

jaydeepw commented 9 years ago

if you want to add a language, please add appropriate string.xml file in a newly created directory and send me PR, I will merge. Read more about localization on android. Let me know if you need any help.

tomoyuki28jp commented 9 years ago

Japanese translations here:

<string name="done">完了</string>
<string name="cancel">キャンセル</string>
<string name="take_photo">カメラ</string>
<string name="gallery">写真</string>
<string name="progress_title">写真を保存中...</string>
<string name="no_images_selected">選択中の写真はありません</string>
<string name="imageview_content_description">アルバムの写真</string>
<string name="imageview_capture_photo_content_description">写真を撮る</string>
<string name="n_images_selected">写真は%1$s枚までしか選択できません</string>
<string name="photo_save_error_toast">写真を保存できません</string>

If you want me to create a pull request, please let me know which directory and file name I should add these translations to.

jaydeepw commented 9 years ago

@tomoyuki28jp Thanks for the translation. Please google and find out the identifier for strings.xml file in values directory. I think it will be something like /res/values-jp/strings.xml but I am not sure. Please search and find and put these translations in appropriate location and send a PR. Let me know if I can help.

tomoyuki28jp commented 9 years ago

@jaydeepw Thanks for your reply. Yeah, as you said, the directory name seems 'values-ja'. I'll create a pull request then.

jaydeepw commented 9 years ago

@tomoyuki28jp Please submit a PR on develop branch.

tomoyuki28jp commented 9 years ago

Please submit a PR on develop branch.

@jaydeepw Oh, okay! Thanks for letting me know that in advance :)

jaydeepw commented 8 years ago

Converted methods to protected so as to enable overriding when extending from ImagePickerActivity.