add word list fr

This commit is contained in:
Tykayn 2022-11-17 13:53:15 +01:00 committed by tykayn
parent aec2561889
commit 6665db9e9c
5 changed files with 67 additions and 38 deletions

Binary file not shown.

View File

@ -35,7 +35,6 @@ const messages = defineMessages({
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' },
keyboard_shortcuts: { id: 'navigation_bar.keyboard_shortcuts', defaultMessage: 'Keyboard shortcuts' }, 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' }, lists_subheading: { id: 'column_subheading.lists', defaultMessage: 'Lists' },
misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' }, misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' },
menu: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, menu: { id: 'getting_started.heading', defaultMessage: 'Getting started' },

View File

@ -4,6 +4,14 @@ const messages = {
'navigation_bar.app_settings': 'Config de ouf', 'navigation_bar.app_settings': 'Config de ouf',
'tabs_bar.local_timeline': 'Bilveusées locales', 'tabs_bar.local_timeline': 'Bilveusées locales',
'tabs_bar.federated_timeline': 'La mine de sel', '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); export default Object.assign({}, inherited, messages);

View File

@ -60,7 +60,7 @@
background-position: top left; background-position: top left;
background-attachment: fixed; background-attachment: fixed;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: 100vh;
.compose-panel{ .compose-panel{
//background-image: linear-gradient(transparent, #15141A 90%); //background-image: linear-gradient(transparent, #15141A 90%);
} }
@ -79,3 +79,8 @@
margin-right: 2ch; margin-right: 2ch;
} }
} }
.skin-mastodon-light{
.navigation-bar__profile, strong{
color: white;
}
}

View File

@ -22,6 +22,7 @@ import { length } from 'stringz';
import { countableText } from '../util/counter'; import { countableText } from '../util/counter';
import Icon from 'mastodon/components/icon'; import Icon from 'mastodon/components/icon';
import { maxChars } from '../../../initial_state'; 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'; 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}!' }, publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' },
saveChanges: { id: 'compose_form.save_changes', defaultMessage: 'Save changes' }, saveChanges: { id: 'compose_form.save_changes', defaultMessage: 'Save changes' },
}); });
let publishText = '';
export default @injectIntl export default @injectIntl
class ComposeForm extends ImmutablePureComponent { class ComposeForm extends ImmutablePureComponent {
@ -74,17 +76,17 @@ class ComposeForm extends ImmutablePureComponent {
handleChange = (e) => { handleChange = (e) => {
this.props.onChange(e.target.value); this.props.onChange(e.target.value);
} };
handleKeyDown = (e) => { handleKeyDown = (e) => {
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
this.handleSubmit(); this.handleSubmit();
} }
} };
getFulltextForCharacterCounting = () => { 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 = () => { canSubmit = () => {
const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props; const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
@ -92,9 +94,11 @@ class ComposeForm extends ImmutablePureComponent {
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0; const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (isOnlyWhitespace && !anyMedia)); return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (isOnlyWhitespace && !anyMedia));
} };
handleSubmit = (e) => { handleSubmit = (e) => {
console.log('handle du submit');
if (this.props.text !== this.autosuggestTextarea.textarea.value) { if (this.props.text !== this.autosuggestTextarea.textarea.value) {
// Something changed the text inside the textarea (e.g. browser extensions like Grammarly) // Something changed the text inside the textarea (e.g. browser extensions like Grammarly)
// Update the state to match the current text // 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); this.props.onSubmit(this.context.router ? this.context.router.history : null);
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
} };
onSuggestionsClearRequested = () => { onSuggestionsClearRequested = () => {
this.props.onClearSuggestions(); this.props.onClearSuggestions();
} };
onSuggestionsFetchRequested = (token) => { onSuggestionsFetchRequested = (token) => {
this.props.onFetchSuggestions(token); this.props.onFetchSuggestions(token);
} };
onSuggestionSelected = (tokenStart, token, value) => { onSuggestionSelected = (tokenStart, token, value) => {
this.props.onSuggestionSelected(tokenStart, token, value, ['text']); this.props.onSuggestionSelected(tokenStart, token, value, ['text']);
} };
onSpoilerSuggestionSelected = (tokenStart, token, value) => { onSpoilerSuggestionSelected = (tokenStart, token, value) => {
this.props.onSuggestionSelected(tokenStart, token, value, ['spoiler_text']); this.props.onSuggestionSelected(tokenStart, token, value, ['spoiler_text']);
} };
handleChangeSpoilerText = (e) => { handleChangeSpoilerText = (e) => {
this.props.onChangeSpoilerText(e.target.value); this.props.onChangeSpoilerText(e.target.value);
} };
handleFocus = () => { handleFocus = () => {
if (this.composeForm && !this.props.singleColumn) { if (this.composeForm && !this.props.singleColumn) {
@ -139,13 +142,13 @@ class ComposeForm extends ImmutablePureComponent {
this.composeForm.scrollIntoView(); this.composeForm.scrollIntoView();
} }
} }
};
componentDidMount() {
this._updateFocusAndSelection({});
} }
componentDidMount () { componentDidUpdate(prevProps) {
this._updateFocusAndSelection({ });
}
componentDidUpdate (prevProps) {
this._updateFocusAndSelection(prevProps); this._updateFocusAndSelection(prevProps);
} }
@ -159,13 +162,13 @@ class ComposeForm extends ImmutablePureComponent {
let selectionEnd, selectionStart; let selectionEnd, selectionStart;
if (this.props.preselectDate !== prevProps.preselectDate && this.props.isInReply) { 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; selectionStart = this.props.text.search(/\s/) + 1;
} else if (typeof this.props.caretPosition === 'number') { } else if (typeof this.props.caretPosition === 'number') {
selectionStart = this.props.caretPosition; selectionStart = this.props.caretPosition;
selectionEnd = this.props.caretPosition; selectionEnd = this.props.caretPosition;
} else { } else {
selectionEnd = this.props.text.length; selectionEnd = this.props.text.length;
selectionStart = selectionEnd; selectionStart = selectionEnd;
} }
@ -176,7 +179,7 @@ class ComposeForm extends ImmutablePureComponent {
this.autosuggestTextarea.textarea.setSelectionRange(selectionStart, selectionEnd); this.autosuggestTextarea.textarea.setSelectionRange(selectionStart, selectionEnd);
this.autosuggestTextarea.textarea.focus(); this.autosuggestTextarea.textarea.focus();
}).catch(console.error); }).catch(console.error);
} else if(prevProps.isSubmitting && !this.props.isSubmitting) { } else if (prevProps.isSubmitting && !this.props.isSubmitting) {
this.autosuggestTextarea.textarea.focus(); this.autosuggestTextarea.textarea.focus();
} else if (this.props.spoiler !== prevProps.spoiler) { } else if (this.props.spoiler !== prevProps.spoiler) {
if (this.props.spoiler) { if (this.props.spoiler) {
@ -185,40 +188,53 @@ class ComposeForm extends ImmutablePureComponent {
this.autosuggestTextarea.textarea.focus(); this.autosuggestTextarea.textarea.focus();
} }
} }
} };
setAutosuggestTextarea = (c) => { setAutosuggestTextarea = (c) => {
this.autosuggestTextarea = c; this.autosuggestTextarea = c;
} };
setSpoilerText = (c) => { setSpoilerText = (c) => {
this.spoilerText = c; this.spoilerText = c;
} };
setRef = c => { setRef = c => {
this.composeForm = c; this.composeForm = c;
}; };
handleEmojiPick = (data) => { handleEmojiPick = (data) => {
const { text } = this.props; const { text } = this.props;
const position = this.autosuggestTextarea.textarea.selectionStart; const position = this.autosuggestTextarea.textarea.selectionStart;
const needsSpace = data.custom && position > 0 && !allowedAroundShortCode.includes(text[position - 1]); const needsSpace = data.custom && position > 0 && !allowedAroundShortCode.includes(text[position - 1]);
this.props.onPickEmoji(position, data, needsSpace); this.props.onPickEmoji(position, data, needsSpace);
} };
render () { render() {
const { intl, onPaste, showSearch } = this.props; const { intl, onPaste, showSearch } = this.props;
const disabled = this.props.isSubmitting; const disabled = this.props.isSubmitting;
let publishText = '';
if (this.props.isEditing) { const locale = document.documentElement.lang;
publishText = intl.formatMessage(messages.saveChanges);
} else if (this.props.privacy === 'private' || this.props.privacy === 'direct') { console.log('is editing', this.props.isEditing);
publishText = <span className='compose-form__publish-private'><Icon id='lock' /> {intl.formatMessage(messages.publish)}</span>;
} else {
publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish); 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 =
<span className='compose-form__publish-private'><Icon id='lock' /> {intl.formatMessage(messages.publish)}</span>;
} else {
publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish);
}
} }
return ( return (
@ -297,3 +313,4 @@ class ComposeForm extends ImmutablePureComponent {
} }
} }