only translate name.default when translation is same source and source_id#1555
Open
missinglink wants to merge 1 commit intomasterfrom
Open
only translate name.default when translation is same source and source_id#1555missinglink wants to merge 1 commit intomasterfrom
missinglink wants to merge 1 commit intomasterfrom
Conversation
…slation is same source and source_id
Member
|
I think we talked about this the other day, but can you provide some more details and background here regarding the issue at hand, maybe some test cases, etc? It will be good to have for reference in the future. |
| if (adminLayer !== doc.layer){ continue; } | ||
| if (adminSource !== doc.source){ continue; } | ||
| if (_.toString(adminID) !== _.toString(doc.source_id)){ continue; } | ||
| doc.name.default = translations[adminID].names[requestLanguage][0]; |
Member
There was a problem hiding this comment.
I wonder if we actually need this line now. Looking through the history of this file, the translateNameDefault method was added in 2019 in #1301, whereas the rest of the file is mostly much older.
It might be that the name translation is already handled well now? I'm not 100% sure, the intention behind this code is definitely hard to read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
middleware/changeLanguage.jscode is a little too liberal when replacing thename.defaultwith a translation.Prior to this PR the code replaces
name.defaultwithout first checking thesourceandsource_id.note: I struggled a bit to read and write this code, requires a second set of 👀