From 3b71a860582ff40e8ada5bce8a1816cf45cbeb04 Mon Sep 17 00:00:00 2001 From: jimbiscuit Date: Wed, 1 Mar 2023 11:24:55 +0100 Subject: [PATCH] feat: Add translation --- locales/en/LC_MESSAGES/volto.po | 17 ++++++++++++++++ locales/fr/LC_MESSAGES/volto.po | 32 +++++++++++++++++++++++++++++++ locales/volto.pot | 7 ++++++- src/widget/IconSelectorWidget.jsx | 11 ++++++++++- 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 locales/en/LC_MESSAGES/volto.po create mode 100644 locales/fr/LC_MESSAGES/volto.po diff --git a/locales/en/LC_MESSAGES/volto.po b/locales/en/LC_MESSAGES/volto.po new file mode 100644 index 0000000..52864b5 --- /dev/null +++ b/locales/en/LC_MESSAGES/volto.po @@ -0,0 +1,17 @@ +msgid "" +msgstr "" +"Project-Id-Version: Plone\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language: en\n" +"Language-Team: \n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: widget/IconSelectorWidget +# defaultMessage: Search... +msgid "Search..." +msgstr "" diff --git a/locales/fr/LC_MESSAGES/volto.po b/locales/fr/LC_MESSAGES/volto.po new file mode 100644 index 0000000..1f32d19 --- /dev/null +++ b/locales/fr/LC_MESSAGES/volto.po @@ -0,0 +1,32 @@ +# Translation of plone.pot to French +# French Translation Team , 2003-2006. +# Sebastien Douche , 2005-2007. +# Encolpe Degoute , 2006, 2007, 2008. +# Gilles Lenfant , 2008. +# Encolpe Degoute , 2008. +# Vincent Fretin , 2009. +# Kevin Deldycke , 2009. +# JeanMichel FRANCOIS , 2010. +# Denis Bitouzé , 2019. +msgid "" +msgstr "" +"Project-Id-Version: Plone\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-04-27T19:30:59.079Z\n" +"PO-Revision-Date: 2016-10-22 16:41-0500\n" +"Last-Translator: Benoît Suttor \n" +"Language: fr\n" +"Language-Team: French \n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Language-Code: fr\n" +"Language-Name: French\n" +"Preferred-Encodings: utf-8 latin1\n" +"X-Is-Fallback-For: fr-be fr-ca fr-lu fr-mc fr-ch fr-fr\n" + +#: widget/IconSelectorWidget +# defaultMessage: Search... +msgid "Search..." +msgstr "Rechercher ..." diff --git a/locales/volto.pot b/locales/volto.pot index 1b22bc0..695c573 100644 --- a/locales/volto.pot +++ b/locales/volto.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: Plone\n" -"POT-Creation-Date: 2021-01-29T12:34:47.097Z\n" +"POT-Creation-Date: 2023-03-01T09:07:18.024Z\n" "Last-Translator: Plone i18n \n" "Language-Team: Plone i18n \n" "MIME-Version: 1.0\n" @@ -12,3 +12,8 @@ msgstr "" "Language-Name: English\n" "Preferred-Encodings: utf-8\n" "Domain: volto\n" + +#: widget/IconSelectorWidget +# defaultMessage: Search... +msgid "Search..." +msgstr "" diff --git a/src/widget/IconSelectorWidget.jsx b/src/widget/IconSelectorWidget.jsx index b4ffa58..46b93c4 100644 --- a/src/widget/IconSelectorWidget.jsx +++ b/src/widget/IconSelectorWidget.jsx @@ -2,9 +2,17 @@ import _ from 'lodash'; import React, { useState } from 'react'; import { FormFieldWrapper } from '@plone/volto/components'; import { Search, Icon } from 'semantic-ui-react'; +import { useIntl, defineMessages } from 'react-intl'; import config from '@plone/volto/registry'; import '../styles/style.less'; +const messages = defineMessages({ + placeholder: { + id: 'Search...', + defaultMessage: 'Search...', + }, +}); + const initialState = { loading: false, results: {}, @@ -28,12 +36,13 @@ function reducer(state, action) { } const IconSelectorWidget = (props) => { + const intl = useIntl(); const { id, value: blockValue, onChange, onBlur, - placeholder = 'Search...', + placeholder = intl.formatMessage(messages.placeholder), } = props; const inputId = `field-${id}`;