Closed federico2390 closed 2 years ago
@federico2390 Sorry about late comment. You can refer in README.md, below section.
// Setup image picker configs (global settings for app) var configs = ImagePickerConfigs(); configs.appBarTextColor = Colors.black; configs.stickerFeatureEnabled = false; // ON/OFF features configs.translateFunc = (name, value) => Intl.message(value, name: name); // Use intl function
Hello, i have tried but if i change one label when i run the changes is reflected on all the label not just in the label that i want.
I have this:
`void main() { WidgetsFlutterBinding.ensureInitialized(); ErrorWidget.builder = (FlutterErrorDetails details) { return ErrorWidget(details.exception); };
var configs = ImagePickerConfigs(); configs.appBarTextColor = Colors.black; configs.translateFunc = (name, value) => Intl.message('Fotocamera', name: 'image_picker_camera_title'); configs.appBarBackgroundColor = Colors.white; configs.filterFeatureEnabled = false; configs.cropFeatureEnabled = false; configs.stickerFeatureEnabled = false; configs.appBarDoneButtonColor = kPrimaryColor;
initializeDateFormatting().then((_) { Intl.systemLocale = 'it_IT'; runApp(const Main()); }); }`
But this is what I see....
@federico2390 Sorry about my confused answer. If you use l10n to support multi language, let define this function inside main.dart configs.translateFunc = (name, value) => Intl.message(value, name: name);
then, add string of plugin inside your intl_**.arb file. for example: `{ "app_title": "FreeMar - Share your things", "image_picker_exit_without_selecting": "Do you want to exit without selecting images?", "image_picker_select_images_title": "Selected images count", "image_picker_select_images_guide": "You can drag images for sorting list...", "image_picker_camera_title": "Camera", "image_picker_album_title": "Album", "image_picker_preview_title": "Preview", "image_picker_confirm_delete": "Do you want to delete this image?", "image_picker_confirm_reset_changes": "Do you want to clear all changes for this image?", "image_picker_no_images": "No images...", "image_picker_image_crop_title": "Image crop", "image_picker_image_filter_title": "Image filter", "image_picker_image_edit_title": "Image edit", "image_picker_select_button_title": "Select", "image_picker_image_sticker_title": "Image sticker", "image_picker_image_addtext_title": "Image add text", "image_picker_image_sticker_guide": "You can click on below icons to add into image, double click to remove it from image", "image_picker_edit_text": "Edit text", "suitcase": "Suitcase", "handbag": "Handbag", "bottle": "Bottle", "tie": "Tie",
}`
@federico2390 I just updated README.md https://github.com/weta-vn/advance_image_picker/blob/master/README.md
I have create intl_it.arb with:
{
"image_picker_select_images_title": "Selezionate",
}
Now in main.dart I have type:
var configs = ImagePickerConfigs();
configs.appBarTextColor = Colors.black;
configs.translateFunc = (name, value) =>
Intl.message(value, name: 'image_picker_select_images_title');
Is correct? Because I don't see nothing change... Sorry
@federico2390 You don't need modify translateFunc function. Try to use bellow code. configs.translateFunc = (name, value) => Intl.message(value, name: name);
Ok but I need to use flutter_translation or something like this?
You don't need must to use l10n for translation. You can use your solution, then write your translateFunc to translate your message.
Like this
configs.translateFunc = (name, value) { var v = trans(name); return v ?? value; }
with trans is your translate function.
Perfect but maybe I don't have a "translate function"... What is this?
You need provide trans function for plugin translating it's strings. Could you tell me about how your app support multi language?
My app is only in Italian and I would like to translate your nice package into Italian language
@federico2390 Can you try code like this.
// configs.translateFunc = (name, value) => Intl.message(value, name: name);
configs.translateFunc = (name, value) {
switch (name) {
case 'image_picker_select_images_title':
return 'Le immagini selezionate contano';
case 'image_picker_select_images_guide':
return 'È possibile trascinare le immagini per lelenco di ordinamento...';
case 'image_picker_camera_title':
return 'Telecamera';
case 'image_picker_album_title':
return 'Album';
// ... Declare all your strings here
default:
return value;
}
}
Perfect work!!! Thx
Can u explain me here?
Text(?????);