Skip to content

Commit

Permalink
Internationalize tweet text for UI share button and title for popup s…
Browse files Browse the repository at this point in the history
…hare button
  • Loading branch information
dmstern committed Apr 5, 2022
1 parent 84d4ab1 commit 2d82bc9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions assets/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"message": "Kontakt",
"description": "label of the contact link"
},
"popup_tweet": {
"message": "https://twitter.com/share?text=Mit dem @LikersBlocker könnt ihr Leute blocken, die menschenverachtende Tweets liken.&url=https://dmstern.github.io/likers-blocker&hashtags=LikersBlocker,sayNoToHateSpeech,ichbinhier",
"tweet_text": {
"message": "https://twitter.com/share?text=Einen rassistischen oder anderweitig richtig ätzenden Tweet gefunden und Leute liken das auch noch? Mit dem @LikersBlocker könnt ihr in Sekunden alle blocken, mit denen ihr sicher nichts zu tun haben wollt.&url=https://dmstern.github.io/likers-blocker&hashtags=LikersBlocker,sayNoToHateSpeech,ichbinhier",
"description": "href for the tweet button. Contains a prefilled tweet text."
},
"ui_blockAll": {
Expand Down
4 changes: 2 additions & 2 deletions assets/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"message": "Contact",
"description": "label of the contact link"
},
"popup_tweet": {
"message": "https://twitter.com/share?text=With the @LikersBlocker you can block people that like hate speech.&url=https://dmstern.github.io/likers-blocker&hashtags=LikersBlocker,sayNoToHateSpeech,ichbinhier",
"tweet_text": {
"message": "https://twitter.com/share?text=Found a racist or otherwise disgusting tweet and people even like those stuff? @LikersBlocker helps you to get rid of those people within seconds.&url=https://dmstern.github.io/likers-blocker&hashtags=LikersBlocker,sayNoToHateSpeech",
"description": "href for the tweet button. Contains a prefilled tweet text."
},
"ui_blockAll": {
Expand Down
2 changes: 1 addition & 1 deletion assets/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ <h1>Likers Blocker</h1>
</a>

<span class="space"></span>
<a class="twitter-link" data-href="popup_tweet" target="_blank" title="Tweet this">
<a class="twitter-link" data-href="tweet_text" target="_blank" data-title="popup_share">
<svg
class="share-icon"
fill="none"
Expand Down
7 changes: 7 additions & 0 deletions assets/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ function localizeUI() {
const msg = client.i18n.getMessage(messageName);
element.setAttribute("href", msg);
});

const titleNodes = document.querySelectorAll("[data-title]");
titleNodes.forEach((element) => {
const messageName = element.dataset.title;
const msg = client.i18n.getMessage(messageName);
element.setAttribute("title", msg);
});
}

function alignRightButton() {
Expand Down
2 changes: 1 addition & 1 deletion src/LikersBlocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ export default class LikersBlocker {
<li class="lb-footer__item">
<a class="lb-footer__link lb-footer__link--share ${LikersBlocker.getBadgeClass(
"share"
)}" href="https://twitter.com/share?text=With the @LikersBlocker you can block people that like hate speech.&url=https://dmstern.github.io/likers-blocker&hashtags=LikersBlocker,sayNoToHateSpeech,ichbinhier" target="_blank" title="${client.i18n.getMessage(
)}" href="${client.i18n.getMessage("tweet_text")}" target="_blank" title="${client.i18n.getMessage(
"popup_share"
)}">${Icons.share}</a>
</li>
Expand Down

0 comments on commit 2d82bc9

Please sign in to comment.