Closed k3b closed 7 years ago
I want to add something like a "translate this app with Stringlate" to the settings menu of my app.
Well thank you for liking my application that much! Maybe I could make some badge or icons for people to use. Currently, if you try starting an intent to https://github.com/k3b/APhotoManager/
Stringlate will appear as suggested application but won't always be the case if the user "Uses always" the web browser.
I will take a look at this but sadly won't be available until the next release, and I don't have a due date for it.
please note in my example i use ACTION_TRANSLATE not ACTION_VIEW which does not exist yet. If other apps/browsers unwantedly responed to ACTION_TRANSLATE we can invent some other intent-detail to make it unique (i.e a new mime-type)
Yes, I'm trying to make the <action name="io.github.lonamiwebs.stringlate.TRANSLATE">
for it to be unique and am trying to solve this ActivityNotFoundException
. I probably open a wiki for the technically inclined with this information in more detail.
Edit: Ok fixed.
For now you can refer to Api.java
. Any more ideas on how the Api could be extended are appreciated.
By the way since I tried this with your application, I saw the about_content_about
string, and it's super long! It perhaps looks daunting at first (overall if the users don't know HTML), I wonder if there is any different way to present such long strings to the users?
I agree that html content is a problem especially long html.
My translation portal https://crowdin.com/project/androFotoFinder made the raw html unusable so i had to manually correct it after downloading. This is especiallia difficuilt for me with japanese ;-)
My current solution for this is to move these problematic strings to a different resource file html-pages.xml.
In the long term i plan to add context sensitive html-online help that points to github-wiki i.e. https://github.com/k3b/APhotoManager/wiki/settings
these can be edited by any github-users (see romanian page https://github.com/k3b/APhotoManager/wiki/ro-features for example)
I see stringlate more as a tool for ad-hoc translators:
I want to make it as easy as possible to contribute to the translations.
for html content you would need a kind of wysiwyg html or markdown editor.
may be there is already a foss android wysiwyg html or markdown editor that your can open with an intent ?
My current solution for this is to move these problematic strings to a different resource file html-pages.xml.
Stringlate will internally merge all the non-default resource files and show them with no special differentiation though, unless the file is called donottranslate.xml
or similar or the <string>
has translatable="false"
.
may be there is already a foss android wysiwyg html or markdown editor that your can open with an intent ?
This person had the same problem. I was just trying TinyMCE with little success too. I can't find any application of this kind on F-Droid, either. Droid Writer seems dead as well. So I don't really know. But yes, being able to use an external editor would be great.
I have installed stringlate-0.9.7 from fdroid-store
When integrationg the api class it cannot find and start the stringlate translate service.
After
the start the stringlate translate service starts through the intent-api works as expected with the selefcompiled stringlate but not with the fdroid download.
any idea what might have gone wrong??
i am using an android-4.4 phone
Very strange. I can't reproduce the bug, but these are my steps:
v0.9.9
from F-Droid.io.github.lonamiwebs.teststringlateapi
).Api.java
class to the project.new Api().translate(this, "https://github.com/LonamiWebs/Stringlate");
on click.I have no clue what can be happening. It's very strange.
Maybe it is because of android-4.4 and in the manifest https://github.com/LonamiWebs/Stringlate/blob/master/src/app/src/main/AndroidManifest.xml
the translate-intent is not browsable <category android:name="android.intent.category.BROWSABLE" />
<intent-filter>
<action android:name="io.github.lonamiwebs.stringlate.TRANSLATE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
tonight i will try it with my android-4.2 tablet.
the translate-intent is not browsable
That doesn't seem to explain this though:
stringlate translate service starts through the intent-api works as expected with the self compiled stringlate but not with the fdroid download
I'm not sure why compiling it yourself made it work, but F-Droid's version doesn't. You mentioned you had v0.9.7
:
I have installed stringlate-0.9.7 from fdroid-store
You need v0.9.8
or higher for it to work. Perhaps that's your issue? Can't you update via F-Droid?
yesterday when i testet, "0.9.7" was newest version my local fdroid knew about. maybe i forgot to update fdroid-data.
speculation why self compiled worked and fdroid-version failed:
when i compile may app and string-late on my own they both get the same publisher key (my local-debug-publischer) that grants me more android-permissions (i.e. start via non-browsable-intent)
Alright, then it's not the publisher key or anything like that, don't worry. Simply put, people (and so do you) require v0.9.8
or higher, because below that version, this wasn't yet implemented. Try updating the repositories on the F-Droid application, and Stringlate should have an update to v0.9.9
.
ok. thanks for info
i found this in the docs:
https://developer.android.com/reference/android/content/Intent.html#CATEGORY_BROWSABLE
at least it should not do any harm to add CATEGORY_BROWSABLE to the translate intent
it should not do any harm to add CATEGORY_BROWSABLE to the translate intent
It would, because it needs some parameters to run correctly. (namely an EXTRA_REPO
bundle, specifying the repository that will be translated). The application would currently crash because it's assumed that those parameters will be passed, and they would not be passed if invoked via a (normal) launcher application.
google app store uses urls like ACTION_VIEW market://details?id=
what about ACTION_VIEW translate://github.com/k3b/APhotoManager?branch=master&language=en,de
<!-- catches if caller mime-type is not given or null -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="translate" />
</intent-filter>
<!-- catches if caller mime-type is something -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="translate" android:mimeType="*/*" />
</intent-filter>
Note: you need both in your manifest. in your app
Uri uri = intent.getData();
you can enter this in the webbrowser to test it.
i have implemented geo:-uris this way.
if you like i can implement this api for you and send you a merge request
what about ACTION_VIEW translate://github.com/k3b/APhotoManager?branch=master&language=en,de
Because I can't simply assume https
. Entering, for example, git@github.com:LonamiWebs/Stringlate.git
, would also work. How would you distinguish this via translate://
…?
This is something I thought of on the first attempt (using a custom scheme), but I think the way it's currently implemented gives more flexibility, and it's almost as simple.
Once again, opening https://github.com/owner/repository
will also allow Stringlate to be chosen (unless the user picked another application).
ok if you want to use http/https/ftp makes it more complicated.
github uses this format to supply a username:
you can translate this to
i agree that a "nice url" makes it more complicated to implement. using your api class should be enought.
I hope that i succeed to start v0.9.9 from my app
now i am at home.
with stringlate-0.9.9 it works as expected on my android-4.2 tablet and on my android-4.4 mobile phone. so the issue really was that i used stringlate-0.9.7 before.
I will add code to install stringlate from app store if it is not installed and send you a mergerequest.
thanks for support.
I want to add something like a ""translate this app with Stringlate" to the settings menu of my app.
This should create an Intent that would open Stringlate with the parameters necessary to load the string resources and open the translate gui.
The code to call Stringlate could be something like this:
Is it possible to add a Stringlate-Intent-API?