indieweb-post-kinds icon indicating copy to clipboard operation
indieweb-post-kinds copied to clipboard

Improve kind views for i18n

Open metbril opened this issue 6 years ago • 4 comments

I noticed that some of the code in the views that will eventually can be localized is split up into chunks with multiple _e() statements. This makes it hard if not impossible to properly translate these texts.

The other day I read the i18n/l10n handbook and I want to check the plugin code against these recommendations.

https://github.com/dshanske/indieweb-post-kinds/blob/eaa62f46900200e044cfb341bef3590928bf6e23/views/kind-like.php#L41

I will have a look and submit a PR. Initially with 1 example open for discussion. Then if we agree on how to approach this, I will add more commits for the other views.

metbril avatar Aug 21 '18 14:08 metbril

I did some thinking... 🤔

For example.

Here are some simplified sentences to show the issue if we want proper localization.

Original English Dutch translation
Liked a post by author Vindt een bericht van auteur leuk
Bookmarked a page by author Maakte een bladwijzer van een pagina van auteur
Replied to a post by author Reageerde op een bericht van auteur
Reposted a post by author Plaatste een bericht van auteur opnieuw

As you might notice, the English verb at the beginning is split across the sentence. Unfortunately, the plugin provides some variations in the output:

  1. Icon + Text + URL/Title + by Author
  2. Text + URL/Title + by Author
  3. Icon + URL/Title + by Author
  4. Icon + Text + URL/Title
  5. Text + URL/Title
  6. Icon + URL/Title

To support translation for any possible variation, each view kind should have one translatable _e() for each of these variations. This would mean some re-arranging of logic, but also a lot of sentences to be translated.

Wouldn't this mean adding a lot of complexity and redundancy to the plugin?

What do you think?

metbril avatar Aug 21 '18 20:08 metbril

the translations would have to be littered with markup for it to work effectively :/

Ruxton avatar Oct 10 '18 06:10 Ruxton

This is also a duplicate/extension of your last issue, #205

Ruxton avatar Oct 10 '18 06:10 Ruxton

I'm willing to entertain suggestions on how to address it best. I don't mind rearranging the logic if it helps with that, but to @Ruxton 's point, I'd like to not make the code too confusing for people.

dshanske avatar Oct 10 '18 11:10 dshanske