Skip to content

Conversation

InAnYan
Copy link
Member

@InAnYan InAnYan commented Sep 13, 2025

Closes #11377 and #9605.

Added:

  • Transliteration field formatter.
  • Transliteration of citation keys.
  • Ability to turn off or on transliteration for citation keys.

Result:

2025-09-13_12-00

Steps to test

  • Enter author in Cyrillic script or Chinese language.
  • Turn on "Transliterate fields" (turned on by default).
  • Click "Generate key".

Results:

2025-09-13_11-49 2025-09-13_12-55

Mandatory checks

@InAnYan
Copy link
Member Author

InAnYan commented Sep 13, 2025

I expect that I chose some wrong naming or placement

@ParameterizedTest(name = "string={0}, expected={1}")
@CsvSource({
"Hello, Hello", // English
"Grüße, Grusse", // German
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be Gruesse with ue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, yeah, but icu4j has other opinion 😅

I will look if there is any option.

But maybe this is the most "general transliteration", because ü, I think, is present not only in German

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dunno, would be okay for me ... I think we cannot get perfect

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This triggered that we still use an old patched version of icu4j. 72.0.1,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can resovle this?

@InAnYan
Copy link
Member Author

InAnYan commented Sep 16, 2025

Sorry, forgot a bit about this PR

@Siedlerchr
Copy link
Member

It would be nice to have this finished, seems like you just need to adjust the mocks/options in the test?

}

@VisibleForTesting
public static CitationKeyPatternPreferences getInstanceForTesting() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to a test util class. This does not belong here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In package testutils?

@InAnYan
Copy link
Member Author

InAnYan commented Sep 22, 2025 via email

return shouldTransliterateFields.get();
}

public BooleanProperty shouldTransliterateFieldsProperty() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method should return an Optional instead of a BooleanProperty to avoid returning null and to follow modern Java best practices.

}

private static String buildTransliteratorConfig() {
StringBuilder pattern = new StringBuilder();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using StringBuilder for simple string concatenation can be replaced with StringJoiner for better readability and maintainability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really?

@jabref-machine
Copy link
Collaborator

JUnit tests of jablib are failing. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Unit tests (pull_request)" and click on it.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

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

Successfully merging this pull request may close these issues.

Other alphabets (for example, Cyrillic) should be transliterated to ASCII in making citation keys
4 participants