Skip to content
This repository has been archived by the owner on Jan 23, 2019. It is now read-only.

Stringlate crashes when trying to add a "locale" #195

Closed
Olf0 opened this issue Apr 18, 2018 · 7 comments
Closed

Stringlate crashes when trying to add a "locale" #195

Olf0 opened this issue Apr 18, 2018 · 7 comments

Comments

@Olf0
Copy link

Olf0 commented Apr 18, 2018

Steps to reproduce

  1. Start Stringlate.
  2. Tap on an subscribed repository.
  3. Tap on the menu button ("︙") in the upper right corner.
  4. Tap on the menu entry, "+ Add new locale".
  5. Tap on a locale offered in the list: Stringlate crashes and after a restart still no locale is selected.

Expected behaviour

A new locale is selected (without a crash).

General information

Tested with Stringlate 0.14 from F-Droid under AOSP 4.1.2 (API level 16).

Logs

Main log and Event log, filtered for lonamiwebs.

Potentially relevant lines from main log:
I dalvikvm: Could not find method android.app.DialogFragment.onAttach, referenced from method io.github.lonamiwebs.stringlate.dialogs.LocaleSelectionDialog.onAttach
E AndroidRuntime: at io.github.lonamiwebs.stringlate.dialogs.LocaleSelectionDialog.dismissDialogWithLocaleResult(LocaleSelectionDialog.java:175)
E AndroidRuntime: at io.github.lonamiwebs.stringlate.dialogs.LocaleSelectionDialog$5.onLocaleSelected(LocaleSelectionDialog.java:137)
E AndroidRuntime: at io.github.lonamiwebs.stringlate.adapters.LocaleEntryAdapter$3.onClick(LocaleEntryAdapter.java:169)

P.S.: Finally I understood the references to "locales", now that I was able to see the locale selection list in Stringlate 0.14 (I was unable to reach it in Stringlate 0.13, as I could not subscribe a repository).

@Olf0
Copy link
Author

Olf0 commented Apr 21, 2018

Note, that this bug exists since Stringlate 0.11.
Selecting a "locale" via the old locale selection list in Stringlate 0.10 works (but the new one has improved look, feel and a search function), but subsequently assigning the selected locale always fails.

BTW, why is selecting a "locale" so crucial?
I was not able to select one yet (in any Stringlate 0.1x) and still translating strings was (once, with v0.11 and 0.12) possible.

@Lonami
Copy link
Member

Lonami commented Apr 21, 2018

why is selecting a "locale" so crucial?

Well, you need to select the language into which you will translate the application. As far as I know, there's no way to accurately infer the language you're writing your translation on to do this automatically. I can't assume you want to translate it into the language of your device either, since a lot of people have their phone in English, or are able to talk several languages.

@Olf0
Copy link
Author

Olf0 commented Apr 21, 2018

Well, you need to select the language into which you will translate the application.

For FFupdater (and also for ApkTrack, when I had it working), I used the "Selected locale" drop down menu (first line on the upper left, after selecting a subscribed repository) for this, as the menu entry "+ Add locale" fails for me.

As far as I know, there's no way to accurately infer the language you're writing your translation on to do this automatically. I can't assume you want to translate it into the language of your device either, since a lot of people have their phone in English, or are able to talk several languages.

Sure.
Sorry, I was not phrasing the question comprehensively. Second try:
"Why should one add a locale (as stated in the on screen message after adding a new repository), when one can select the wanted locale from the existing ones of subscribed repositories?"
If "+ Add locale" is adding a new internationalisation language for the currently selected repository, then aforementioned on-screen message is IMO somewhat misleading (as this is not necessary when the wanted language already exists in the specific repository), or am I missing something?

@Lonami
Copy link
Member

Lonami commented Apr 22, 2018

Say this application had no translation. I would have to add the new Spanish locale if I wanted to translate it to my mother language.

On the other hand, if the application already had a Spanish translation, I could just select the existing locale. So. selecting a locale lists only existing ones, while adding adds one that doesn't exist already.

@Lonami
Copy link
Member

Lonami commented Apr 23, 2018

NPE:

E/AndroidRuntime: FATAL EXCEPTION: main
                  java.lang.NullPointerException
                      at io.github.lonamiwebs.stringlate.dialogs.LocaleSelectionDialog.dismissDialogWithLocaleResult(LocaleSelectionDialog.java:175)
                      at io.github.lonamiwebs.stringlate.dialogs.LocaleSelectionDialog$5.onLocaleSelected(LocaleSelectionDialog.java:137)
                      at io.github.lonamiwebs.stringlate.adapters.LocaleEntryAdapter$3.onClick(LocaleEntryAdapter.java:174)
                      at android.view.View.performClick(View.java:4084)
                      at android.view.View$PerformClick.run(View.java:16966)
                      at android.os.Handler.handleCallback(Handler.java:615)
                      at android.os.Handler.dispatchMessage(Handler.java:92)
                      at android.os.Looper.loop(Looper.java:137)
                      at android.app.ActivityThread.main(ActivityThread.java:4745)
                      at java.lang.reflect.Method.invokeNative(Native Method)
                      at java.lang.reflect.Method.invoke(Method.java:511)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                      at dalvik.system.NativeStart.main(Native Method)

@Lonami
Copy link
Member

Lonami commented Apr 23, 2018

Apparently the onAttach method is never called, so it fails:

I/dalvikvm: Could not find method android.app.DialogFragment.onAttach, referenced from method io.github.lonamiwebs.stringlate.dialogs.LocaleSelectionDialog.onAttach
W/dalvikvm: VFY: unable to resolve virtual method 215: Landroid/app/DialogFragment;.onAttach (Landroid/content/Context;)V

See https://stackoverflow.com/a/37228701/4759433.

@Lonami
Copy link
Member

Lonami commented Apr 23, 2018

Hey, emulators are pretty nice after all. Had to clone from GitLab since GitHub fails, as @gsantner explained, due to old SSL issues

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

No branches or pull requests

2 participants