Skip to content

Conversation

Dlurak
Copy link
Collaborator

@Dlurak Dlurak commented Sep 18, 2024

Description

While the labels were already internationalized the values weren't. The code was already written but never actually applied due to a small logic error.
Now units and translated values are shown in the feature panel.

Language Old New
German old_german new_german
Spanish old_spanish new_spanish

Checklist

  • checked dark mode / light mode
  • checked mobile / desktop
  • checked server-side-rendering (SSR)
  • code style is consistent with the rest of the project
  • new dependencies are reasoned about in PR comments

Copy link

vercel bot commented Sep 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
osmapp ✅ Ready (Inspect) Visit Preview Sep 18, 2024 7:21pm

@Dlurak Dlurak merged commit e456b08 into zbycz:master Sep 18, 2024
2 checks passed
Comment on lines -33 to -36
// combo with options
if (fieldTranslation?.options?.[v]) {
return renderValue(k, fieldTranslation.options[v]?.title);
}
Copy link
Owner

Choose a reason for hiding this comment

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

I think this case can also occur sometimes. Can you please check it? Or say so, and i will try to find it.

This code is quite smelly 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is very much possible that I overlooked something - but I think it was only blocking the translations and actually being used

Copy link
Owner

Choose a reason for hiding this comment

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

👌

@zbycz
Copy link
Owner

zbycz commented Sep 20, 2024

Great fix, very welcomed :) thanks 🙂

I feel we need some more tests to this whole id-tagging-scheme integration. I think this worked some time before, but it is easy to break anything :) -> #573

@Dlurak
Copy link
Collaborator Author

Dlurak commented Sep 21, 2024

It is easy to break anything

About that, it seems like I've broken something: Schools. It is definitely very fragile and we need more tests

I will investigate the problem later this day

@zbycz
Copy link
Owner

zbycz commented Sep 22, 2024

I don't see an issue eg here https://osmapp.org/way/318017486

It was very hard and experimential to build it in the first place. With current knowledge I know much better how I want to use it. I do some refactors in #506 - I will try to add some tests along.

@Dlurak
Copy link
Collaborator Author

Dlurak commented Sep 22, 2024

It seems to work on some schools, but this one doesn't work: https://osmapp.org/way/194819147

And there are way more that don't work

@Dlurak
Copy link
Collaborator Author

Dlurak commented Sep 22, 2024

Ok so the problem is that the internationalized value is undefined when there is a tag contact:email without a tag email.
The computed key is email so it tries to get the value as tags['email'] which doesn't exist as there is only a contact:email so the value becomes undefined which then fails in the function that returns a url for a tag as you can't do v.match when v is undefined.
I hope it is clear what i mean.
This is how the field looks:

email: {
    key: 'email',
    keys: [ 'email', 'contact:email' ],
    type: 'email',
    fieldKey: 'email'
  }

@Dlurak
Copy link
Collaborator Author

Dlurak commented Sep 22, 2024

@zbycz I think I have a fix! are you working on a refactoring or should I open a new pr?

Dlurak added a commit to Dlurak/osmapp that referenced this pull request Sep 22, 2024
@zbycz
Copy link
Owner

zbycz commented Sep 22, 2024

I think i get what you might mean. That if there is no translation in fieldTranslations, then it fails?

Feel free to fix it. I will work on #506 probably next week, so i will rebase on master.

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

Successfully merging this pull request may close these issues.

2 participants