New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon fieldtype options are not translated correctly (Incl. patch) #1084

Closed
rrelmy opened this Issue Nov 3, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@rrelmy

rrelmy commented Nov 3, 2016

Expected behaviour

The fieldtype_fields in a addon should show the text defined in a language file.

Actual behaviour

The options are visible but the title and instruct message are not available, it displays:
fieldtypes/test.foobar and fieldtypes/test.foobar_instruct

The text should be prefixed with the addon namespace for translations.
addons.Test::fieldtypes.foobar

Steps to reproduce

  1. php please make:fieldtype Test
  2. Add fieldtype_fields to the meta.yaml file
fieldtype_fields:
  foobar:
    type: text
  1. Try to add the titles and instruct messages somewhere (example: resources/lang/en/fieldtypes.php)
  2. Add the field to a fieldset and look at the foobar option

Server configuration

Statamic version: 2.1.17

@rrelmy

This comment has been minimized.

rrelmy commented Aug 13, 2017

😏

Index: statamic/core/Http/Controllers/FieldtypesController.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- statamic/core/Http/Controllers/FieldtypesController.php	(date 1502631999000)
+++ statamic/core/Http/Controllers/FieldtypesController.php	(revision )
@@ -35,8 +35,13 @@
                     $c[$field->getName()] = $field->preProcess($c[$field->getName()]);
                 }
 
-                $c['display'] = trans("fieldtypes/{$fieldtype->getHandle()}.{$c['name']}");
-                $c['instructions'] = markdown(trans("fieldtypes/{$fieldtype->getHandle()}.{$c['name']}_instruct"));
+                if ($fieldtype->isFirstParty()) {
+                    $c['display'] = trans("fieldtypes/{$fieldtype->getHandle()}.{$c['name']}");
+                    $c['instructions'] = markdown(trans("fieldtypes/{$fieldtype->getHandle()}.{$c['name']}_instruct"));
+                } else {
+                    $c['display'] = trans('addons.'.$fieldtype->getFieldtypeName().'::fieldtypes.'.$c['name']);
+                    $c['instructions'] = markdown(trans('addons.'.$fieldtype->getFieldtypeName().'::fieldtypes.'.$c['name'].'_instruct'));
+                }
 
                 $config[] = $c;
             }

@rrelmy rrelmy changed the title from Addon fieldtype options are not translated correctly to Addon fieldtype options are not translated correctly (Incl. patch) Aug 13, 2017

evanrobertson pushed a commit to evanrobertson/statamic-colorpicker that referenced this issue Mar 6, 2018

Evan Robertson
Adding fieldtype properties to configure the colorpicker
The field details are currently not being displayed correctly in Statamic 2.8.7 which is a known issue statamic/v2-hub#1084

@jackmcdade jackmcdade added the l10n label Jun 5, 2018

@jackmcdade jackmcdade closed this Jun 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment