indieweb-post-kinds
indieweb-post-kinds copied to clipboard
Improve kind views for i18n
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.
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:
- Icon + Text + URL/Title + by Author
- Text + URL/Title + by Author
- Icon + URL/Title + by Author
- Icon + Text + URL/Title
- Text + URL/Title
- 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?
the translations would have to be littered with markup for it to work effectively :/
This is also a duplicate/extension of your last issue, #205
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.