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

Strings unused, yet still translatable #379

Closed
trikaphundo opened this issue Sep 26, 2024 · 5 comments
Closed

Strings unused, yet still translatable #379

trikaphundo opened this issue Sep 26, 2024 · 5 comments
Milestone

Comments

@trikaphundo
Copy link
Contributor

The problem

There are a few strings available to translate, although they are no longer used in the UI.

Examples

See these, for instance.

Possible causes

I suspect that these strings fell in oblivion with successive changes of the program.

I have working on the translation of Primitive FTPd for some releases now, so I remember seeing some of the unused strings in the values.xml back when they were used; namely, when the user interface had a three-dot menu, instead of the current tabbed bar.

Possible solutions

Erase unused strings and update all translations with the changes.

hamidsafdari added a commit to hamidsafdari/prim-ftpd that referenced this issue Sep 29, 2024
@hamidsafdari
Copy link
Contributor

The way to find unused strings would be to:

  • Press Ctrl+Shift+A to open the "Find Action" menu
  • Find "Run Inspection by Name..."
  • Find "Unused resources"
  • In the opened dialog, set a file mask of "strings.xml" and click OK

That will open a pane with all the unused strings. There's then a quick fix button to remove all the unused strings. This will also remove unused strings from the translated files. The inspection is not perfect and says some used strings are unused. So I went over all of the removed strings, added them back one by one and pressed Alt+F7 on each. Some of the strings were indeed used and I could find usages in either XML or Java files. For others, I couldn't find any usages so I removed them.

Running the inspection again, will only find 6 unused strings but they are false flags and have usages. I also kept a string I used in #363.

In case there is a need to restore any of the strings, here's how I would do it:

  • git revert [hash of this commit]
  • git reset --soft HEAD~1

That will put all the removed strings in staging. I would then undo all the changes and only keep the string I need.

@wolpi wolpi added this to the 7.3 milestone Sep 29, 2024
@wolpi
Copy link
Owner

wolpi commented Sep 29, 2024

I'll have a look

@wolpi
Copy link
Owner

wolpi commented Sep 29, 2024

I see #386 is already there. We are close to solve this 😄

@trikaphundo
Copy link
Contributor Author

trikaphundo commented Sep 29, 2024

The way to find unused strings would be to:

* Press Ctrl+Shift+A to open the "Find Action" menu

* Find "Run Inspection by Name..."

* Find "Unused resources"

* In the opened dialog, set a file mask of "strings.xml" and click OK

This is to be done in Android Studio, right? So I could do it as well.
When opening the issue, I could not come up with an automated solution to find unused strings, so I decided to just point to an example. Thank you so much.

In case there is a need to restore any of the strings, here's how I would do it:

* `git revert [hash of this commit]`

* `git reset --soft HEAD~1`

That will put all the removed strings in staging. I would then undo all the changes and only keep the string I need.

Great.

@hamidsafdari
Copy link
Contributor

This is to be done in Android Studio, right? So I could do it as well.

Yes. You can do it too. You can also access the menu from "Code > Analyze Code > Run Inspection by Name".

lmagyar pushed a commit to lmagyar/prim-ftpd that referenced this issue Oct 3, 2024
wolpi added a commit that referenced this issue Oct 5, 2024
@wolpi wolpi closed this as completed Oct 5, 2024
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