-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Terms preset does not work properly #2756
Comments
Same here. Steps to reproduce
Expected result
Actual result
This seems to work fine for longer keys though: e.g. NoteThe translation of terms that is included in this instance of iD is |
OK, I think I found the reason behind that semi-random behavior. For instance,
To work properly, it must be changed to:
I am not sure where the fix should be though. Some solutions could be:
|
No, that should not have any impact. It is true that lowercase and without spaces is preferable, but it is not necessary to have the search work. |
What is doing the work for it then? I tried on a local copy and had it working only by changing as mentioned. But I am not |
I haven't looked at that code myself, I was told so by an iD developer some time ago. IIRC it splits on commas and then calculates the Levenshtein distance. It may be that with the comma, the Levenshtein distance is bigger, but for longer words this does not matter too much? |
This seems to be the relevant code: https://github.com/openstreetmap/iD/blob/master/js/id/presets/collection.js#L75, but I am not really familiar with the code. |
Well, Levenshtein distance is not the only method used; basically
Levenshtein distance might find expected result sometimes - but not in first position (see my first post with edit: renaming |
Observation of the app's behaviour:
|
What did you modify? In
Then recompile the application entirely with |
Seems you are right. Without capitals it finds it. |
I am working on this. I first changed js/id/presets/preset.js # 49: /*from*/ return preset.t('terms', {'default': ''}).split(',');
/* to */ return preset.t('terms', {'default': ''}).toLowerCase().split(','); and it worked but then I thought: why make the client do that every time, when we can settle this at |
Fix "terms" translations (closes #2756)
* upstream/master: (346 commits) Add test case for callback function returning false Correct coding style Make raw tag editor show docs for key=value (closes openstreetmap#2754) Improvements to access field (closes openstreetmap#2763) Disable fullscreen button, add keyboard shortcuts update tests to reflect changes in dd32ec3 Correct API version in osmChange and changeset XML Fix "terms" translations (closes openstreetmap#2756) Remove Raven code (closes openstreetmap#2769) Less strict polygon intersection test in findOuter (closes openstreetmap#2755) Use different leaf_cycle/leaf_type for singular tree (closes openstreetmap#2753) And don't show "mixed" options for singular tree (closes openstreetmap#2752) Change caption "Access" -> "Allowed Access" (closes openstreetmap#2761) Fix broken link and other help improvements (closes openstreetmap#2760) don't try to label if centroid is undefined Remove unnecessary PhantomJS install step (as mocha-phantomjs is already included as dev dependency) switch jshint to eslint (closes openstreetmap#2733) Add make rule to npm install maki Replace 'X' with Cancel button on save panel (closes openstreetmap#2378) Add recycling:glass_bottles, recycling:plastic (closes openstreetmap#2730) Add preset for leisure=bowling_alley (closes openstreetmap#2734) ...
If I understood it correctly,
terms
list inpreset
are synonyms for one kind of structure. For instance, given the French presets,Digue
should be equivalent ofTerre-plein
(for keyembankment
). However if a select a line and typeDigue
,Terre-plein
is the 32nd of 34 total results while it should have been the 1st.The same goes for other words (
WC
is not leading totoilets
, etc.), so am I misinterpreting theseterms
or is something wrong?Using iceweasel 40.0 on Debian 4.1.5-1, same behavior on 2 different computers as well as on Windows/Firefox. French installed on both computers but one has iceweasel in French while the other has it in English.
The text was updated successfully, but these errors were encountered: