Skip to content
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

Column labels don't get labels from locallang.xlf #1468

Closed
renepapenfuss opened this issue Oct 18, 2017 · 11 comments · May be fixed by #1919
Closed

Column labels don't get labels from locallang.xlf #1468

renepapenfuss opened this issue Oct 18, 2017 · 11 comments · May be fixed by #1919

Comments

@renepapenfuss
Copy link

renepapenfuss commented Oct 18, 2017

Hi everyone,

I don't know if that is a bug or I'm missing something, but I hope it's ok to post this here. I have the following page setup:

EXT:linear/Resources/Private/Templates/Page/Standard.html

<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
    xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
    xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
    xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers">

    <f:layout name="Page"/>

    <f:section name="Configuration">
        <flux:form id="standard">
            <flux:grid>
                <flux:grid.row>
                    <flux:grid.column colPos="0" colspan="3" name="welcome"/>
                </flux:grid.row>
                <flux:grid.row>
                    <flux:grid.column colPos="11" name="feature_left"/>
                    <flux:grid.column colPos="12" name="feature_center"/>
                    <flux:grid.column colPos="13" name="feature_right"/>
                </flux:grid.row>
                <flux:grid.row>
                    <flux:grid.column colPos="2" colspan="3" name="tweet"/>
                </flux:grid.row>
            </flux:grid>
        </flux:form>
    </f:section>
    ...
</div>

In my locallang.xlf I try to set the labels of the columns:

EXT:linear/Resources/Private/Language/locallang.xlf

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xliff version="1.0">
    <file source-language="en" datatype="plaintext" original="messages" product-name="linear" date="2017-09-20T14:17:40+00:00">
        <header/>
        <body>
            <trans-unit id="flux.standard">
                <source>Standard</source>
            </trans-unit>
            <trans-unit id="flux.standard.columns.welcome">
                <source>Welcome</source>
            </trans-unit>
            <trans-unit id="flux.standard.columns.feature_left">
                <source>Features (Left)</source>
            </trans-unit>
            <trans-unit id="flux.standard.columns.feature_center">
                <source>Features (Center)</source>
            </trans-unit>
            <trans-unit id="flux.standard.columns.feature_right">
                <source>Features (Right)</source>
            </trans-unit>
            <trans-unit id="flux.standard.columns.news">
                <source>News</source>
            </trans-unit>
            <trans-unit id="flux.standard.columns.tweet">
                <source>Tweet</source>
            </trans-unit>
        </body>
    </file>
</xliff>

I cleared all caches and reloaded the backend but the columns are labeled with the small written names defined in my page configuration. Shouldn't it display the names defined in my locallang.xlf?

EDIT:
I'm using TYPO3 8.7.8 and Flux 8.2.1

@jmverges
Copy link
Member

jmverges commented Oct 18, 2017

I'm having the same problem, I would say. As far as I debugged looks like extensionName is always empty
image

@jmverges
Copy link
Member

@anisiearadis for temporal workaround try with
<flux:form id="standard" extensionName="linear">
and please, let me know if you got any better result

@renepapenfuss
Copy link
Author

@jmverges I tried this now. It looks like something is happening now, but nothing gets show now. Only empty strings are displayed.

@rupasix
Copy link
Contributor

rupasix commented Dec 6, 2017

I've had this problem when we've upgraded flux and fluidpages to dev versions from github. Adding my provider extension name to <flux:form extensionName=""> fixed that. Flux know where to look but don't have defaults?

@GuidoJansen
Copy link

GuidoJansen commented Jun 8, 2018

@anisiearadis Did you use Camelcase of underscore extension name.
Underscore should be the correct one
user_ext_name: yes
userExtName : no

@NamelessCoder
Copy link
Member

The right format for extensionName is either UpperCamelCase or Vendor.UpperCamelCase versions of the extension key. Flux will internally convert to whichever format is needed.

@Josta
Copy link

Josta commented Aug 4, 2018

Starting with Flux 9, there's another reason why grid columns don't get locallang.xlf labels.

To build the LLL path, resolveLocalLanguageValueOfLabel() in AbstractFormComponent.php looks for the name of the root component. No matter where I place the grid definition (inside or outside <flux:form>), the root component is always <flux:grid> which has a default name of 'grid' (This name can't be changed without crashing BTW, presumably another bug).

So Flux looks for the label in flux.grid.columns.[column name] instead of flux.[form ID].columns.[column name]. This should be changed because otherwise we're not able to name the columns differently in different content elements (within the same provider extension).

@OrangeLeinad
Copy link

I also do not have backend labelings with flux version >= 9 anymore. In earlier flux version < 9 that did work for me:

Content HTML-File:

<f:section name="Configuration">
	<flux:form id="grid_12"></flux:form>
	<flux:grid>
		<flux:grid.row>
			<flux:grid.column colPos="0" name="main" />
		</flux:grid.row>
	</flux:grid>
</f:section>

Language-File:

<trans-unit id="flux.grid_12">
	<source>Grid 12</source>
</trans-unit>
<trans-unit id="flux.grid_12.columns.main">
	<source>Main (12)</source>
</trans-unit>

Has something changed we do not know?

@NamelessCoder
Copy link
Member

NamelessCoder commented Aug 8, 2018

@Josta already identified the cause of the problem. A patch would have to fix the ViewHelper that creates the grid so it gets the Form as parent even if the Grid is defined outside the flux:form tag. If someone is willing to give that a try, that would be appreciated!

@NamelessCoder
Copy link
Member

Solved in dev-development and very likely already released. Forgive my laziness for not looking up the specific patch ;)

cweiske added a commit to mogic-le/test_provider_extension that referenced this issue Jan 24, 2022
cweiske added a commit to mogic-le/test_provider_extension that referenced this issue Jan 24, 2022
@cweiske
Copy link
Contributor

cweiske commented Jan 24, 2022

This is not fixed in flux 9.5.0-13-g3cc50474 - see the demo in https://github.com/mogic-le/test_provider_extension/tree/test-column-label--flux-1468
For the "Standard" page layout:

  • I moved <flux:grid> inside <flux:form>
  • I moved the main column label into the translation file with key flux.standard.columns.main. This one does not get used.
  • I added translation key flux.grid.columns.main, which gets used instead.

The goal should be that the page layout specific key is used.

Please re-open the issue.


Problem seems to be that the column's root element is still the grid and not the form, despite my page layout's XML modifications. (FluidTYPO3\Flux\Form\Container\Grid when doing var_dump(get_class($root)); in Classes/Form/AbstractFormComponent.php#338)

cweiske added a commit to mogic-le/flux that referenced this issue Jan 25, 2022
Labels of columns in page layouts were only translatable with the generic
non-specific key "flux.grid.columns.$columnName".

This patch sets the page layout's grid parent object to be the page layout's form,
so that the resolved parent ID is that of the form.

A column named "one" within a page layout with id "twocol" will thus get
the label key "flux.twocol.columns.one", just as it was for flux 8.

Resolves: FluidTYPO3#1468
cweiske added a commit to mogic-le/flux that referenced this issue Jan 27, 2022
Labels of columns in page layouts were only translatable with the generic
non-specific key "flux.grid.columns.$columnName".

This patch sets the page layout's grid parent object to be the page layout's form,
so that the resolved parent ID is that of the form.

A column named "one" within a page layout with id "twocol" will thus get
the label key "flux.twocol.columns.one", just as it was for flux 8.

If the backend layout cannot be found because the page template file does
not exist anymore, we need to return NULL from buildBackendLayout()
to get a proper error message.

Resolves: FluidTYPO3#1468
cweiske added a commit to mogic-le/flux that referenced this issue May 6, 2022
Labels of columns in page layouts were only translatable with the generic
non-specific key "flux.grid.columns.$columnName".

This patch sets the page layout's grid parent object to be the page layout's form,
so that the resolved parent ID is that of the form.

A column named "one" within a page layout with id "twocol" will thus get
the label key "flux.twocol.columns.one", just as it was for flux 8.

If the backend layout cannot be found because the page template file does
not exist anymore, we need to return NULL from buildBackendLayout()
to get a proper error message.

Resolves: FluidTYPO3#1468
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants