?
avatar infograf768
infograf768
16 Mar 2017

Let's take "Safe html"
we find it 3 times

en-GB.plg_fields_editor.ini:16: PLG_FIELDS_EDITOR_PARAMS_FILTER_SAFEHTML="Safe HTML"
en-GB.plg_fields_text.ini:14: PLG_FIELDS_TEXT_PARAMS_FILTER_SAFEHTML="Safe HTML"
en-GB.plg_fields_textarea.ini:16: PLG_FIELDS_TEXTAREA_PARAMS_FILTER_SAFEHTML="Safe HTML"

same for "Raw", etc.
screen shot 2017-03-16 at 18 20 56

We could just add them once in com_fields.ini and get rid of these redundancies.

@brianteeman @laoneo @Bakual
What do you think?

avatar infograf768 infograf768 - open - 16 Mar 2017
avatar joomla-cms-bot joomla-cms-bot - change - 16 Mar 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 16 Mar 2017
avatar brianteeman
brianteeman - comment - 16 Mar 2017

Agree - we should never have KEYS with the same name in different language files

avatar infograf768
infograf768 - comment - 16 Mar 2017

You mean same value I guess.
But some maybe necessary to let customise depending on languages.
In this case there is no customisation possible (or even desired).

We could for example use
<option value="safehtml">COM_FIELDS_PARAMS_FILTER_SAFEHTML</option>
instead of
<option value="safehtml">PLG_FIELDS_EDITOR_PARAMS_FILTER_SAFEHTML</option>

avatar brianteeman
brianteeman - comment - 16 Mar 2017

oops sorry - was reading on my phone i thought these had the same key

In this case I guess its ok to use a generic string but its something to be careful with for others as they might be translated differently depending on the context - although they wont be here

avatar infograf768
infograf768 - comment - 16 Mar 2017

That's why I wrote

In this case there is no customisation possible (or even desired).

avatar Bakual
Bakual - comment - 16 Mar 2017

I don't think com_fields.ini is the right place to add it. You would have to load com_fields language files when editing the plugin parameters.
You may add it to the en-GB.ini or the lib one (if that one is loaded at that place always). For the filter options, this may make sense as they basically are referring to a library class method.

But there is something wrong for sure as https://github.com/joomla/joomla-cms/blob/staging/plugins/fields/editor/params/editor.xml#L41-L57 is using the language strings from the "text" field, not the "editor" ones. Looks like a copy-paste error ?
Will do the PR for that.

avatar infograf768
infograf768 - comment - 17 Mar 2017

@Bakual
As far as I could see with debug language, com_fields.ini is always loaded when custom fields are edited. xx-XX.ini is always loaded as well as xx.XX.lib.joomla

**Loaded** : JROOT/administrator/language/en-GB/en-GB.ini
**Loaded** : JROOT/administrator/language/en-GB/en-GB.lib_joomla.ini
**Loaded** : JROOT/administrator/language/en-GB/en-GB.plg_system_updatenotification.ini
**Loaded** : JROOT/administrator/language/en-GB/en-GB.plg_system_fields.ini
**Loaded** : JROOT/administrator/language/en-GB/en-GB.plg_system_logout.ini
**Loaded** : JROOT/administrator/language/en-GB/en-GB.tpl_isis.ini
**Loaded** : JROOT/administrator/language/en-GB/en-GB.com_fields.ini
etc.

I would prefer to use com_fields ini as we have other strings in the same case. for example these with the value "Use From Plugin", 9 of them...

en-GB.plg_fields_editor.ini:23: PLG_FIELDS_EDITOR_PARAMS_USE_GLOBAL="Use From Plugin"
en-GB.plg_fields_imagelist.ini:14: PLG_FIELDS_IMAGELIST_PARAMS_USE_GLOBAL="Use From Plugin"
en-GB.plg_fields_integer.ini:16: PLG_FIELDS_INTEGER_PARAMS_USE_GLOBAL="Use From Plugin"
en-GB.plg_fields_media.ini:16: PLG_FIELDS_MEDIA_PARAMS_USE_GLOBAL="Use From Plugin"
en-GB.plg_fields_sql.ini:12: PLG_FIELDS_SQL_PARAMS_USE_GLOBAL="Use From Plugin"
en-GB.plg_fields_text.ini:17: PLG_FIELDS_TEXT_PARAMS_USE_GLOBAL="Use From Plugin"
en-GB.plg_fields_textarea.ini:21: PLG_FIELDS_TEXTAREA_PARAMS_USE_GLOBAL="Use From Plugin"
en-GB.plg_fields_url.ini:12: PLG_FIELDS_URL_PARAMS_USE_GLOBAL="Use From Plugin"
en-GB.plg_fields_usergrouplist.ini:10: PLG_FIELDS_USERGROUPLIST_PARAMS_USE_GLOBAL="Use From Plugin"

As for editor, yep, I really wondered why telephone (to take only one example) was a filter for editor... ;)
I guess we need there: No, Use From Plugin, text, safehtml, raw

In another PR, we should add separately the possibility to choose the editor and syntax

Therefore, if you agree, I will make the patch using com_fields.ini

avatar infograf768
infograf768 - comment - 17 Mar 2017

Or
we could add the "Use from Plugin" in com_fields.ini as it is specific to custom fields
and the others in lib rather than xx-XX.ini as lib is loaded both in front and backend and indeed could be used in the future for other stuff.

avatar infograf768
infograf768 - comment - 17 Mar 2017

If used in lib we would have:

JLIB_FILTER_PARAMS_RAW="Raw"
JLIB_FILTER_PARAMS_SAFEHTML="Safe HTML"
JLIB_FILTER_PARAMS_TEXT="Text"
JLIB_FILTER_PARAMS_ALNUM="Alpha Numeric"
JLIB_FILTER_PARAMS_INTEGER="Integer"
JLIB_FILTER_PARAMS_FLOAT="Float"
JLIB_FILTER_PARAMS_TEL="Telephone"
avatar laoneo
laoneo - comment - 17 Mar 2017

What wonders me more is why is the com_fields language file loaded when editing a plugin?

avatar laoneo
laoneo - comment - 17 Mar 2017

@infograf768 the JLIB strings do make sense IMO. Would go that way.

avatar infograf768
infograf768 - comment - 17 Mar 2017

What wonders me more is why is the com_fields language file loaded when editing a plugin?

Well, happily it does as we already have global strings there:
Example

COM_FIELDS_FIELD_DEFAULT_VALUE_LABEL="Default Value"
COM_FIELDS_FIELD_DESCRIPTION_DESC="A description of the field that will be displayed in the label tooltip."
avatar laoneo
laoneo - comment - 17 Mar 2017

These strings should only be used when editing a field, but not the plugin.

avatar infograf768
infograf768 - comment - 17 Mar 2017

Indeed, that's why the params above have to go into the lib to be sure they are loaded.
The global strings are not used for the plugins.
Therefore those with "Use from Plugin" can be safely change to a global one in com_fields.ini

Doing patch today

avatar Bakual
Bakual - comment - 17 Mar 2017

@infograf768 You can't use com_fields because those strings are used in two places. Once when you create/edit a field (here com_fields is loaded). The other place is in the plugin options itself and there com_fields has no business at all. Thus it would fail.
That's what @laoneo and me meant ?

avatar infograf768 infograf768 - change - 17 Mar 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-03-17 10:49:31
Closed_By infograf768
avatar infograf768 infograf768 - close - 17 Mar 2017
avatar infograf768
infograf768 - comment - 17 Mar 2017

Closed as we have a patch: #14683


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14677.

avatar infograf768
infograf768 - comment - 17 Mar 2017

That's what @laoneo and me meant

Yep, I understood. That's why I just added one string to com_fields. ?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14677.

Add a Comment

Login with GitHub to post a comment