From 6665db9e9cbedefb26178b6e53121257d1a517a4 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Thu, 17 Nov 2022 13:53:15 +0100 Subject: [PATCH] add word list fr --- .yarn/install-state.gz | Bin 1775209 -> 1775209 bytes .../glitch/features/getting_started/index.js | 1 - app/javascript/flavours/glitch/locales/fr.js | 8 ++ .../flavours/glitch/styles/_custom_tk.scss | 7 +- .../compose/components/compose_form.js | 89 +++++++++++------- 5 files changed, 67 insertions(+), 38 deletions(-) diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index e3ac97cdc7be00a815a5643c63531e375f35029e..6e37cc48d285596f5cee446b03767fc01787496e 100644 GIT binary patch delta 863 zcmV-l1EBortZeD5Y=DFTgaU*Egam{Iga(8Mgb0KQgbIWUgbaiYgbsucgb;)ggc5`k zgcO7ogcgJsgcyVwgc`IPP!oS~0m0uu+GlaP9Bpl@dJGMuZcGC@Bj*maIO<)gS!&-X zZ6xz4=VNJ!m=i$fK9s;^KpFMYL{G54VkoQgo-Ql*PtD5<2-quh&8n6enGx5`8I|@7 zyEoTf77M4y$jq|q-INDviPg5qXDV~Ztb91RSQj8^Ywo1%9>PQHCNO`;ZbZxUdTBUd zxvOFB;WKa~i?vl-H)GU2*}O@$b5UTya+d#+=LPEm9tz3{}0Kpx`<-dl~w!vpfR$RQEdPQ%^+OWK+vV+fjEc zEkskmWg8R=8z>X)lCyu|V4{g~Tix?oii~_!|4-czO!=KaDa+vs-43fk)%i6U4SPrU za$aQ0EG3t7mzAWZ7y z#Usfg#md0X428?iRz?MUfENv*bk8r7%e zgn+QFx-pu}xK|pgVwO(j&D zcxQ@Is&&q+7POn$m9-^f1fM*j8wlgX-dMC9Xo@h1#J+z=;OpeTdEKnBx2AHwaw|vB zZjt?^eX7J=<$}lxhvyXCgJec+Tb(pmNJgAi7?BCNEW@K?g6ayF>@_DN5sQjEwJA%g zjWutTtERdHmT{JE2(t>hRU_{ei%33-J9!&Wm0xb^mNA<%$K{x1-ei5PMGxIn@AX#Y pGIJ0j9snPq<^e60MkaaCbdgLI!z};C*L}_F{$EHA2Q~=rN&uBpnfw3% delta 863 zcmV-l1EBortZeD5Y=DFTgaU*Egam{Iga(8Mgb0KQgbIWUgbaiYgbsucgb;)ggc5`k zgcO7ogcgJsgcyVwgc`IPP!oT#3UULPd)5gy2TQ|_RbL>RDsHaR|7tL!MXDN>UuHkm53a)LTr zMtqDW8|syY>bIt=RW=Z+=Oy57tBCE{`7Fms)JUjGM4i;4^SVtz6Hn#&%#ZgD!* zx<(~y>i%E$C(M>YJj8;i-Hp_xC9uS4ATDV<|FTY`%M9;Oc^b{Ym=J$4;SWim>Il?NBf$_ZwoChJ^1Cs@GpIM|ulzB#*A zEG4P~MP(6CiVO}dY`{%KBU)hJ>ud+Q p*40S+@E;#Jl1SUCtsACfPl9?KPR>%Qi7|1Vsv5NZhTN&x$4mmdHC diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js index 8dcea1867..51aa8f8cf 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.js +++ b/app/javascript/flavours/glitch/features/getting_started/index.js @@ -35,7 +35,6 @@ const messages = defineMessages({ follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, keyboard_shortcuts: { id: 'navigation_bar.keyboard_shortcuts', defaultMessage: 'Keyboard shortcuts' }, - lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, lists_subheading: { id: 'column_subheading.lists', defaultMessage: 'Lists' }, misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' }, menu: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, diff --git a/app/javascript/flavours/glitch/locales/fr.js b/app/javascript/flavours/glitch/locales/fr.js index f327311b0..977f68e70 100644 --- a/app/javascript/flavours/glitch/locales/fr.js +++ b/app/javascript/flavours/glitch/locales/fr.js @@ -4,6 +4,14 @@ const messages = { 'navigation_bar.app_settings': 'Config de ouf', 'tabs_bar.local_timeline': 'Bilveusées locales', 'tabs_bar.federated_timeline': 'La mine de sel', + 'compose_form.publish': getRandomTermPouet(), + 'compose_form.save_changes': getRandomTermPouet(), + getRandomTermPouet:getRandomTermPouet, }; +export function getRandomTermPouet() { + let items = ['Pouet', 'Révolte', 'Couillère', 'Allez viens', 'On est bien', 'Sapristi', 'PWOUINNNN', 'Squalala', 'C\'est parti', 'Allez', 'Roulez jeunesse', 'Magnéto', 'Illuminer le monde']; + return items[Math.floor(Math.random() * items.length)]; +} + export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/styles/_custom_tk.scss b/app/javascript/flavours/glitch/styles/_custom_tk.scss index 98658017f..848fba318 100644 --- a/app/javascript/flavours/glitch/styles/_custom_tk.scss +++ b/app/javascript/flavours/glitch/styles/_custom_tk.scss @@ -60,7 +60,7 @@ background-position: top left; background-attachment: fixed; background-repeat: no-repeat; - background-size: cover; + background-size: 100vh; .compose-panel{ //background-image: linear-gradient(transparent, #15141A 90%); } @@ -79,3 +79,8 @@ margin-right: 2ch; } } +.skin-mastodon-light{ + .navigation-bar__profile, strong{ + color: white; + } +} diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index 55ffecb49..cbc174539 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -22,6 +22,7 @@ import { length } from 'stringz'; import { countableText } from '../util/counter'; import Icon from 'mastodon/components/icon'; import { maxChars } from '../../../initial_state'; +import { getRandomTermPouet } from '../../../../flavours/glitch/locales/fr'; const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'; @@ -32,6 +33,7 @@ const messages = defineMessages({ publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' }, saveChanges: { id: 'compose_form.save_changes', defaultMessage: 'Save changes' }, }); +let publishText = ''; export default @injectIntl class ComposeForm extends ImmutablePureComponent { @@ -74,17 +76,17 @@ class ComposeForm extends ImmutablePureComponent { handleChange = (e) => { this.props.onChange(e.target.value); - } + }; handleKeyDown = (e) => { if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { this.handleSubmit(); } - } + }; getFulltextForCharacterCounting = () => { - return [this.props.spoiler? this.props.spoilerText: '', countableText(this.props.text)].join(''); - } + return [this.props.spoiler ? this.props.spoilerText : '', countableText(this.props.text)].join(''); + }; canSubmit = () => { const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props; @@ -92,9 +94,11 @@ class ComposeForm extends ImmutablePureComponent { const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0; return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (isOnlyWhitespace && !anyMedia)); - } + }; handleSubmit = (e) => { + console.log('handle du submit'); + if (this.props.text !== this.autosuggestTextarea.textarea.value) { // Something changed the text inside the textarea (e.g. browser extensions like Grammarly) // Update the state to match the current text @@ -106,31 +110,30 @@ class ComposeForm extends ImmutablePureComponent { } this.props.onSubmit(this.context.router ? this.context.router.history : null); - if (e) { e.preventDefault(); } - } + }; onSuggestionsClearRequested = () => { this.props.onClearSuggestions(); - } + }; onSuggestionsFetchRequested = (token) => { this.props.onFetchSuggestions(token); - } + }; onSuggestionSelected = (tokenStart, token, value) => { this.props.onSuggestionSelected(tokenStart, token, value, ['text']); - } + }; onSpoilerSuggestionSelected = (tokenStart, token, value) => { this.props.onSuggestionSelected(tokenStart, token, value, ['spoiler_text']); - } + }; handleChangeSpoilerText = (e) => { this.props.onChangeSpoilerText(e.target.value); - } + }; handleFocus = () => { if (this.composeForm && !this.props.singleColumn) { @@ -139,13 +142,13 @@ class ComposeForm extends ImmutablePureComponent { this.composeForm.scrollIntoView(); } } + }; + + componentDidMount() { + this._updateFocusAndSelection({}); } - componentDidMount () { - this._updateFocusAndSelection({ }); - } - - componentDidUpdate (prevProps) { + componentDidUpdate(prevProps) { this._updateFocusAndSelection(prevProps); } @@ -159,13 +162,13 @@ class ComposeForm extends ImmutablePureComponent { let selectionEnd, selectionStart; if (this.props.preselectDate !== prevProps.preselectDate && this.props.isInReply) { - selectionEnd = this.props.text.length; + selectionEnd = this.props.text.length; selectionStart = this.props.text.search(/\s/) + 1; } else if (typeof this.props.caretPosition === 'number') { selectionStart = this.props.caretPosition; - selectionEnd = this.props.caretPosition; + selectionEnd = this.props.caretPosition; } else { - selectionEnd = this.props.text.length; + selectionEnd = this.props.text.length; selectionStart = selectionEnd; } @@ -176,7 +179,7 @@ class ComposeForm extends ImmutablePureComponent { this.autosuggestTextarea.textarea.setSelectionRange(selectionStart, selectionEnd); this.autosuggestTextarea.textarea.focus(); }).catch(console.error); - } else if(prevProps.isSubmitting && !this.props.isSubmitting) { + } else if (prevProps.isSubmitting && !this.props.isSubmitting) { this.autosuggestTextarea.textarea.focus(); } else if (this.props.spoiler !== prevProps.spoiler) { if (this.props.spoiler) { @@ -185,40 +188,53 @@ class ComposeForm extends ImmutablePureComponent { this.autosuggestTextarea.textarea.focus(); } } - } + }; setAutosuggestTextarea = (c) => { this.autosuggestTextarea = c; - } + }; setSpoilerText = (c) => { this.spoilerText = c; - } + }; setRef = c => { this.composeForm = c; }; handleEmojiPick = (data) => { - const { text } = this.props; - const position = this.autosuggestTextarea.textarea.selectionStart; - const needsSpace = data.custom && position > 0 && !allowedAroundShortCode.includes(text[position - 1]); + const { text } = this.props; + const position = this.autosuggestTextarea.textarea.selectionStart; + const needsSpace = data.custom && position > 0 && !allowedAroundShortCode.includes(text[position - 1]); this.props.onPickEmoji(position, data, needsSpace); - } + }; - render () { + render() { const { intl, onPaste, showSearch } = this.props; const disabled = this.props.isSubmitting; - let publishText = ''; - if (this.props.isEditing) { - publishText = intl.formatMessage(messages.saveChanges); - } else if (this.props.privacy === 'private' || this.props.privacy === 'direct') { - publishText = {intl.formatMessage(messages.publish)}; - } else { - publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish); + const locale = document.documentElement.lang; + + console.log('is editing', this.props.isEditing); + + + if (locale === 'fr') { + let items = ['Pouet', 'Révolte', 'Couillère', 'Allez viens', 'On est bien', 'Sapristi', 'PWOUINNNN', 'Squalala', 'C\'est parti', 'Allez', 'Roulez jeunesse', 'Magnéto', 'Illuminer le monde']; + + publishText = items[Math.floor(Math.random() * items.length)]; + }else{ + if (this.props.isEditing) { + publishText = intl.formatMessage(messages.saveChanges); + + + } else if (this.props.privacy === 'private' || this.props.privacy === 'direct') { + publishText = + {intl.formatMessage(messages.publish)}; + } else { + publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish); + } } return ( @@ -297,3 +313,4 @@ class ComposeForm extends ImmutablePureComponent { } } +