fix for 9699. Added bimap for language-lcid mapping#9729
Conversation
There was a problem hiding this comment.
Good initial shot.
MSBibConverter.java also should be adapted.
Please add test for MsBibConverter using Ctrl+Shift+T
Press then Enter
Then create a test case with a BibEntry.
See IEEETest.java for a more complete example.
|
|
||
| private static final HashBiMap<Field, String> BIBLATEX_TO_MS_BIB = HashBiMap.create(); | ||
|
|
||
| private static final HashBiMap<String, Integer> LANG_TO_LCID = HashBiMap.create(); |
There was a problem hiding this comment.
Do you really need HashBiMap here? Isn't BiMap enough?
See https://github.com/HugoMatilla/Effective-JAVA-Summary#52-refer-to-objects-by-their-interface for a longer explanation
There was a problem hiding this comment.
Doesnt the same logic apply for BIBLATEX_TO_MS_BIB as well?
| @@ -131,8 +170,8 @@ public static MSBibEntryType getMSBibEntryType(EntryType bibtexType) { | |||
| */ | |||
| public static int getLCID(String language) { | |||
| // TODO: add language to LCID mapping | |||
There was a problem hiding this comment.
This TODO can be removed.
Also fix the checkstyle issue!
|
My bad about the unit tests. I'll take a look and make some fixes. Thanks for the quick feedback. |
|
In regards to the unit tests failing, Not quite sure what to do here. Additionally, since @Alexandra-Stath was assigned to this problem first, you do not need to review this PR until she submits a PR as well or says it is okay. I just do not want this to get merged, since she was technically assigned it first as a course project! |
|
Without thinking much, my question would be, why can't Are all these null pointer exceptions really because of this? |
|
I think the tests are failing because the xml files for the tests probably contain 0 for the language. And there is no map entry with 0 inside. So either add an entry for 0 or do something like getOrDefault |
|
@Siedlerchr I'm not sure if that's the case, because the previous implementation of getLCID() returned the hexidecimal value of 1033, which is the LCID for american english. |
This is good! Without thinking deeper about the consequences, just fallback to (And please adapt the wrong comment |
|
I added MSBibConverterTest but I am not sure if that is what you guys are expecting. (my last commit had some missing files, which is why the unit tests were failing :,( ) |
| if (!LANG_TO_LCID.containsKey(language)) { | ||
| return 1033; | ||
| } | ||
| return LANG_TO_LCID.get(language); |
|
Not sure why that one test is now suddenly failing, it works fine on my local machine... |
|
The test sometimes fails randomly on CI. Don't worry. If you think your PR is ready then you can mark it as ready for review. In my opinion it looks good now |
Add import as well
| - We improved the Drag and Drop behavior in the "Customize Entry Types" Dialog [#6338](https://github.com/JabRef/jabref/issues/6338) | ||
| - When determining the URL of an ArXiV eprint, the URL now points to the version [#8149](https://github.com/JabRef/jabref/pull/8149) | ||
| - We Included all standard fields with citation key when exporting to Old OpenOffice/LibreOffice Calc Format [#8176](https://github.com/JabRef/jabref/pull/8176) | ||
| - We Included all standard fields with citation key when exporting to Old OpenOffice/LibreExpoa Calc Format [#8176](https://github.com/JabRef/jabref/pull/8176) |
There was a problem hiding this comment.
@Siedlerchr What is "LibreExpoa"? Is this change in CHANGELOG.md really intended?
There was a problem hiding this comment.
I was editing this on the github, this was not intended


Fixes #9699
Added a private static bimap for supporting more lcids/languages when exporting to MS Office 2007.
Added simple unit tests, but not sure if those are necessary.