Skip to content

Trailing format string in Android is broken #13437

Description

@thgoebel

Describe the issue

In our Android app, we have the following string in our values/strings.xml:

<string name="cmd_camera_response_success">"The device is taking a picture and will send it to FMD Server. You can view it here soon: %s</string>

Note the trailing %s.

Recently, Weblate started to ignore the trailing "s", and suggest to users that they remove it from the translations.

This has resulted in some translators removing the "s", even though it should be there.

This results in the linter (rightfully!) complaining when compiling our Android app:

Error: Format string 'cmd_camera_response_success' is not a valid format string so it should not be passed to String.format [StringFormatInvalid]
          transport.send(context, context.getString(R.string.cmd_camera_response_success, serverUrl))
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /builds/Nulide/findmydevice/app/src/main/res/values-ta/strings.xml:21: This definition does not require arguments

This recently (in the last few weeks) broke. The string in question has not been touched on our main branch since June 2024, and up to now Weblate has not had this issue.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

  1. Define a string with a trailing "%s" in an Android app
  2. Pull it into Weblate

Expected behavior

The %s should be part of the string.

Screenshots

image

Exception traceback

n/a

How do you run Weblate?

weblate.org service

Weblate versions

No response

Weblate deploy checks

No response

Additional context

Weblate project: https://hosted.weblate.org/projects/findmydevice/fmd-android/

Offending string in Gitlab: https://gitlab.com/Nulide/findmydevice/-/blame/1d0dbe75677f4a66bf8c6b2cb3fc5b3edf0013e0/app/src/main/res/values/strings.xml#L192

Offending string in Weblate: https://hosted.weblate.org/translate/findmydevice/fmd-android/en/?checksum=d7d28e73f83c973f

Metadata

Metadata

Assignees

Labels

Blocked by upstreamThe solution to this issue depends on a third-party project and needs to be addressed there first.bugSomething is broken.

Type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions