Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Open file in always localized in english (Android) #331

Open
JaviManteiga opened this issue Sep 10, 2022 · 4 comments
Open

Text Open file in always localized in english (Android) #331

JaviManteiga opened this issue Sep 10, 2022 · 4 comments

Comments

@JaviManteiga
Copy link

JaviManteiga commented Sep 10, 2022

I'm working on a Ionic + cordova project and I use this plugin to open PDFs in Android (with the method showOpenWithDialog of the awesome-cordova-plugins) but when the dialog opens to choose which app you want to open the file with, the header text (Open file in) is always in english. However the cancel button works as expected. I've seen this issue regarding the same problem in iOS but the solution is not applicable to Android. Is this a bug? am I missing something?

Thanks in advance

@JaviManteiga
Copy link
Author

I've been investigating and I found that this text is hardcoded in the FileOpener2.java:141. The fastest "solution" would be to fork the plugin and change the text but that doesn't solve the case where the app is multilanguage. Any ideas on how this text could be sent translated in the current language from the app to the plugin without breaking the ionic interface?

@JaviManteiga JaviManteiga changed the title Test Open file in always localized in english (Android) Text Open file in always localized in english (Android) Sep 11, 2022
@shnist
Copy link
Collaborator

shnist commented Jan 30, 2023

hi @JaviManteiga. Thank you for raising this issue. Unfortunately there are no plans to support other languages with this plugin, but we would be happy to accept a PR.

@bha2020
Copy link

bha2020 commented Feb 22, 2024

@JaviManteiga Can you provide me your solution code to open pdf file in android using ionic ?
try {
this.fileOpener.open(this.pdfPath.toString(), 'application/pdf')
.then(() => console.log('File opened successfully'))
.catch(error => {
console.error('Error opening file:');
for (const prop in error) {
console.error(prop + ':', error[prop]);
}
});
}
catch (error) {
console.error('Error opening document:', error);
}
}
this is my code but its not opening dialog to open pdf

@JaviManteiga
Copy link
Author

@JaviManteiga Can you provide me your solution code to open pdf file in android using ionic ? try { this.fileOpener.open(this.pdfPath.toString(), 'application/pdf') .then(() => console.log('File opened successfully')) .catch(error => { console.error('Error opening file:'); for (const prop in error) { console.error(prop + ':', error[prop]); } }); } catch (error) { console.error('Error opening document:', error); } } this is my code but its not opening dialog to open pdf

I'm not using that function. My code is similar to the example in the docs

https://github.com/pwlin/cordova-plugin-file-opener2?tab=readme-ov-file#quick-example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants