From 0c82b1e64e0693c17be04f75d5528acbe942181a Mon Sep 17 00:00:00 2001 From: nipos Date: Sat, 4 Aug 2018 15:52:34 +0200 Subject: [PATCH] Added multiple language support,removed third party requests --- README.md | 8 +- assets/css/style.css | 59 +- assets/js/emojipicker/emojipicker.js | 20 +- .../halcyon/_webftp_de_IP_185_220_102_4.txt | 8 - assets/js/halcyon/halcyonFunctions.js | 4 +- assets/js/halcyon/halcyonSettings.js | 96 ++- assets/js/halcyon/halcyonTemplates.js | 254 +++---- assets/js/halcyon/halcyonUI.js | 82 +-- assets/js/pomo/pomo.js | 663 ++++++++++++++++++ assets/js/pomo/pomo.min.js | 1 - header.php | 25 +- language.php | 23 +- locale/de_DE/messages.mo | Bin 0 -> 9299 bytes locale/de_DE/messages.po | 540 ++++++++++++++ locale/en_US/LC_MESSAGES/messages.mo | Bin 8537 -> 0 bytes locale/en_US/LC_MESSAGES/messages.po | 487 ------------- locale/en_US/messages.mo | Bin 0 -> 8726 bytes locale/en_US/messages.po | 539 ++++++++++++++ locale/pt_BR/messages.mo | Bin 0 -> 9484 bytes locale/pt_BR/messages.po | 541 ++++++++++++++ login/login.php | 2 +- login/terms.php | 2 +- settings_appearance.php | 24 +- settings_general.php | 39 +- settings_profile.php | 35 +- version.txt | 2 +- 26 files changed, 2676 insertions(+), 778 deletions(-) delete mode 100644 assets/js/halcyon/_webftp_de_IP_185_220_102_4.txt create mode 100644 assets/js/pomo/pomo.js delete mode 100644 assets/js/pomo/pomo.min.js create mode 100644 locale/de_DE/messages.mo create mode 100644 locale/de_DE/messages.po delete mode 100644 locale/en_US/LC_MESSAGES/messages.mo delete mode 100644 locale/en_US/LC_MESSAGES/messages.po create mode 100644 locale/en_US/messages.mo create mode 100644 locale/en_US/messages.po create mode 100644 locale/pt_BR/messages.mo create mode 100644 locale/pt_BR/messages.po diff --git a/README.md b/README.md index e340719..a00b470 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ # Halcyon for Mastodon and Pleroma A webclient for Mastodon and Pleroma which looks like Twitter -## DO NOT USE THE CURRENT MASTER! -The current version in master has been uploaded because an contributor offered help with working towards the next version. This is no complete version. Please get the latest stable release from the releases page. - >The original author of this genius piece of software was inactive for a while and then shut down his demo instance and deleted this repository. I love Halcyon, it's the thing which makes Mastodon the best social network in the world. I took the code from the Halcyon fork of cybre.space which still works but doesn't seem to get updates, too. I uploaded it here to make the original link work again and don't link into the big nothing. I'm working on much other stuff, too, therefore I won't use my whole free time to work on Halcyon. But I try to do as much as possible here. @@ -24,7 +21,11 @@ These instances are publicly accessible and usable by everyone, no matter which You have your own Halcyon instance and want it to be listed here? Create an issue with the link and we will add it to the list. +## Translate +[Help us translating Halcyon into many languages](https://translate.zanata.org/project/view/halcyon) + ## Blog +- [Release of Version 2.0.0 - The biggest changes in detail](https://nikisoft.myblog.de/nikisoft/art/11636651/Halcyon-2-0-0-The-biggest-changes-in-detail) - Release of Version 1.2.6 - Report toots supported,disable CW and NFSW,add privacy policy and imprint,move config files,read release notes for more - Release of Version 1.2.5 - Copy links with one click,emojicodes now always detected,streaming in hashtag search,delete event now supported - Release of Version 1.2.4 - Updated Twemoji,custom emojis in names and bios,links to profiles in pleroma now always work,pinned posts now supported @@ -50,6 +51,7 @@ You have your own Halcyon instance and want it to be listed here? Create an issu - Twitter like UI, familiar interface. - Able to use on all instances. - No tracking, No ads. +- Supports multiple languages ## Requirement - Apache/Nginx/Caddy/lighttpd diff --git a/assets/css/style.css b/assets/css/style.css index dc9ddfb..6df6351 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -1322,7 +1322,7 @@ transition: 0.13s ease-out; .textfield { margin: 10px; padding-left:5px; -width: 50%; +width: 75%; font-size: 14px; color: #66757F; box-sizing: border-box; @@ -2446,3 +2446,60 @@ box-shadow: inset 0 0 0 4px #ffffff; outline: none; border-color: #189EFC; } +.uploadbtn:before { +position:absolute; +left:0; +right:0; +text-align:center; +font-size:12px; +font-weight:600; +content:"Select file and upload"; +} +.s-hidden { +display:none; +} +.select { +cursor:pointer; +display:inline-block; +position:relative; +width:calc(75% - 2px); +} +.styledselect { +width:100%; +margin:10px; +padding:0; +height:28px; +position:relative; +text-align:center; +font-weight:bold; +} +.styledselect.active { +border-bottom-left-radius:0; +border-bottom-right-radius:0; +} +.options { +display:none; +position:absolute; +top:100%; +right:0; +left:0; +z-index:999; +margin:-10px -12px 0 10px !important; +padding:0 0; +list-style:none; +border:1px solid #189EFC; +border-top-width:0; +background-color:white; +border-bottom-left-radius:4px; +border-bottom-right-radius:4px; +} +.options li { +text-align:center; +padding:5px; +transition:0.15s ease-out; +} +.options li:hover { +border:0 solid #189EFC; +border-left-width:5px; +border-right-width:5px; +} diff --git a/assets/js/emojipicker/emojipicker.js b/assets/js/emojipicker/emojipicker.js index de5d1c3..89bccea 100644 --- a/assets/js/emojipicker/emojipicker.js +++ b/assets/js/emojipicker/emojipicker.js @@ -187,15 +187,15 @@ container.append(wrapper); appender.append(container); this.append(appender); if(settings.twemoji){ -twemoji.parse(emojiPeopleContainer[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); -twemoji.parse(emojiNatureContainer[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); -twemoji.parse(emojiFoodsContainer[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); -twemoji.parse(emojiActivityContainer[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); -twemoji.parse(emojiPlacesContainer[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); -twemoji.parse(emojiObjectsContainer[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); -twemoji.parse(emojiSymbolsContainer[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); -twemoji.parse(emojiFlagsContainer[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); -twemoji.parse(tabs[0],{base:(location.protocol==="https:"?"https:":"http:")+"//cdn.staticfile.org/twemoji/2.2.5/"}); +twemoji.parse(emojiPeopleContainer[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); +twemoji.parse(emojiNatureContainer[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); +twemoji.parse(emojiFoodsContainer[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); +twemoji.parse(emojiActivityContainer[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); +twemoji.parse(emojiPlacesContainer[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); +twemoji.parse(emojiObjectsContainer[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); +twemoji.parse(emojiSymbolsContainer[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); +twemoji.parse(emojiFlagsContainer[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); +twemoji.parse(tabs[0],{base:"https://"+current_instance,ext:".svg",folder:"/emoji"}); } this.click(function(e){ e.preventDefault(); @@ -255,4 +255,4 @@ container.append(emoticon); } } }(jQuery, window)); -} \ No newline at end of file +} diff --git a/assets/js/halcyon/_webftp_de_IP_185_220_102_4.txt b/assets/js/halcyon/_webftp_de_IP_185_220_102_4.txt deleted file mode 100644 index 3b6bea4..0000000 --- a/assets/js/halcyon/_webftp_de_IP_185_220_102_4.txt +++ /dev/null @@ -1,8 +0,0 @@ -The file halcyonTemplates.js had been edited by : - -IP: 185.220.102.4 -Time: 15.07.2018|11:54:33 - -This message had been generated by http://www.webftp.de -On abuse issues, please contact abuse@webftp.de - diff --git a/assets/js/halcyon/halcyonFunctions.js b/assets/js/halcyon/halcyonFunctions.js index f8264a0..36c396c 100644 --- a/assets/js/halcyon/halcyonFunctions.js +++ b/assets/js/halcyon/halcyonFunctions.js @@ -118,7 +118,7 @@ return value; return new Date(value); } function getRelativeDatetime(current_time, posted_time) { -const calendar = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; +const calendar = [__("Jan"),__("Feb"),__("Mar"),__("Apr"),__("May"),__("Jun"),__("Jul"),__("Aug"),__("Sep"),__("Oct"),__("Nov"),__("Dec")]; var posted_time_original = posted_time, posted_time = getConversionedDate(null, posted_time_original).getTime(), elapsedTime = Math.ceil((current_time-posted_time)/1000); @@ -384,4 +384,4 @@ function checkEmojiSupport() { var ctx = document.createElement("canvas").getContext("2d"); ctx.fillText("😗",-2,4); return ctx.getImageData(0,0,1,1).data[3] > 0; -} \ No newline at end of file +} diff --git a/assets/js/halcyon/halcyonSettings.js b/assets/js/halcyon/halcyonSettings.js index 2a94482..a6534d5 100644 --- a/assets/js/halcyon/halcyonSettings.js +++ b/assets/js/halcyon/halcyonSettings.js @@ -11,18 +11,21 @@ if(localStorage.setting_who_to_follow == "true") { $("#setting_who_to_follow")[0].checked = true; } }); +$(document).on('change',".language_wrap select[name='language']", function(e) { +$.cookie("language",$(this).val(),{path:'/',expires:3650}); +}); $(document).on('change',".post_privacy_wrap input[name='post_privacy']:checked", function(e) { localStorage.setItem("setting_post_privacy", $(this).val()); -putMessage("Changed setting to "+$(this).val()); +putMessage(__("Changed setting to")+" "+$(this).val()); }); $("#setting_post_sensitive").change(function() { if(this.checked) { localStorage.setItem("setting_post_sensitive","true"); -putMessage("Mark as NSFW by default enabled"); +putMessage(__("Mark as NSFW by default enabled")); } else { localStorage.setItem("setting_post_sensitive","false"); -putMessage("Mark as NSFW by default disabled"); +putMessage(__("Mark as NSFW by default disabled")); } }); $(document).on('change',".local_instance_wrap input[name='local_instance']", function(e) { @@ -32,22 +35,57 @@ localStorage.setItem("setting_local_instance","https://"+$(this).val()); else { localStorage.setItem("setting_local_instance","default"); } -putMessage("Changed setting to "+$(this).val()); +putMessage(__("Changed setting to")+" "+$(this).val()); }); $(document).on('change',".search_filter_wrap input[name='search_filter']:checked", function(e) { localStorage.setItem("setting_search_filter", $(this).val()); -putMessage("Changed setting to "+$(this).val()); +putMessage(__("Changed setting to")+" "+$(this).val()); }); $("#setting_who_to_follow").change(function() { if(this.checked) { localStorage.setItem("setting_who_to_follow","true"); -putMessage("Who to follow enabled"); +putMessage(__("Who to follow enabled")); } else { localStorage.setItem("setting_who_to_follow","false"); -putMessage("Who to follow disabled"); +putMessage(__("Who to follow disabled")); } -}) +}); +$('.selectbox').each(function() { +var $this = $(this), +numberOfOptions = $(this).children('option').length; +$this.addClass('s-hidden'); +$this.wrap('
'); +$this.after('
'); +var $styledSelect = $this.next('div.styledselect'); +var $selectText = $("").css("margin","auto").text($this.children('option[selected]').eq(0).text()+" ⏷"); +$styledSelect.append($selectText); +var $list = $('