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

java: String.format() checks wrongly applied to java-format #7798

Closed
2 tasks done
ptoscano opened this issue Jun 23, 2022 · 2 comments · Fixed by #7920
Closed
2 tasks done

java: String.format() checks wrongly applied to java-format #7798

ptoscano opened this issue Jun 23, 2022 · 2 comments · Fixed by #7920
Assignees
Labels
bug Something is broken.
Milestone

Comments

@ptoscano
Copy link

Describe the issue

It seems that weblate tries to apply the checks for a printf-like version of Java format strings (i.e. the ones for String.format() for messages with the java-format format. From what I can see, this does not match the behaviour of GNU gettext:
https://www.gnu.org/software/gettext/manual/html_node/java_002dformat.html

This can be easily checked:

class Test
{
    public static void main(String args[])
    {
        System.out.println(String.format(tr("Hello, %s!"), "format"));
    }
}

and extracting it:

$ xgettext -o - -ktr test-format.java

gives the following (header removed):

#: test-format.java:5
#, java-printf-format
msgid "Hello, %s!"
msgstr ""

I checked the code of weblate at commit f2f333f:

"java-format": (JAVA_MATCH, c_format_is_position_based),

IMHO the above ought to be java-printf-format rather than java-format.

I already tried

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

Steps to reproduce the behavior

No response

Expected behavior

No response

Screenshots

No response

Exception traceback

No response

How do you run Weblate?

Other

Weblate versions

No response

Weblate deploy checks

No response

Additional context

No response

@nijel
Copy link
Member

nijel commented Jun 24, 2022

When we implemented java-format, Gettext didn't have java-printf-format...

@nijel nijel added this to the 4.14 milestone Jun 28, 2022
@nijel nijel added the bug Something is broken. label Jun 30, 2022
@nijel nijel self-assigned this Jul 25, 2022
nijel added a commit to nijel/weblate that referenced this issue Jul 25, 2022
Weblate didn't follow gettext in the beginning because it did not
support these back then.

Fixes WeblateOrg#7799
Fixes WeblateOrg#7798
nijel added a commit to nijel/weblate that referenced this issue Jul 25, 2022
Weblate didn't follow gettext in the beginning because it did not
support these back then.

Fixes WeblateOrg#7799
Fixes WeblateOrg#7798
nijel added a commit to nijel/weblate that referenced this issue Jul 25, 2022
Weblate didn't follow gettext in the beginning because it did not
support these back then.

Fixes WeblateOrg#7799
Fixes WeblateOrg#7798
nijel added a commit that referenced this issue Jul 25, 2022
Weblate didn't follow gettext in the beginning because it did not
support these back then.

Fixes #7799
Fixes #7798
@github-actions
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

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

Successfully merging a pull request may close this issue.

2 participants