[BUG]: translate not load in admin view #1154

Closed
opened 2024-07-31 13:51:05 +00:00 by saman2 · 4 comments
Member

What Happened?

is specific situation , constant not loaded and when turn on language debug, then show ??key (joomla constant)?? instead value (joomla string)
when JCB compile a component and i install that on fresh joomla 4.4.6, then it can not load string. i don't understand this is a bug or not but i can find the problem (I found out after a lot of pain and bleeding):

If you have used the enter key on the keyboard (line break) in your expressions for translation (for example, the description of a field), Joomla 4 cannot load all or part of that translation file, and that is because of the existence of INI_SCANNER_RAW In this link:
4a21f3ee6a/libraries/src/Language/LanguageHelper.php (L425)
It is in Joomla 4. This problem did not exist in Joomla 3, and for this reason, our component could correctly load translations in Joomla 3, but it could not in Joomla 4.

Steps to reproduce the Bug

It is enough to use the Enter key instead of using \n for the description part of a field in the settings of one of the component fields. Then compile. See that the page of your component that wants to load that field, cannot load strings.

or for simplified the problem, if you do something which result of that like below in the .ini file:

COM_MOOJLA_COURSE_SHOWLOGINTAB_LABEL="Show login tab"
COM_MOOJLA_COURSE_SHOWREGTAB_DESCRIPTION="If you want the "Register" tab to be displayed in the login / course registration option, select Yes, otherwise No
Inherit option uses moojla configuration"
COM_MOOJLA_COURSE_SHOWREGTAB_LABEL="Show register tab"
COM_MOOJLA_COURSE_SHOW_LABEL_CONTENTS_DESCRIPTION="When check this option shows label activity content exclusive of user enrollment or visibility"
COM_MOOJLA_COURSE_SHOW_LABEL_CONTENTS_LABEL="Show label contents"
COM_MOOJLA_COURSE_SP_INPUT="Sp Input"
COM_MOOJLA_COURSE_STARTDATE_LABEL="startdate"

the joomla 4 can not load correctly this file because i use Enter in the value of COM_MOOJLA_COURSE_SHOWREGTAB_DESCRIPTION .

Which Joomla version are you compiling in?

3.2.2

Which PHP version are you compiling in?

8.1

Which Joomla versions are you targeting?

joomla 4.4.6

Which PHP version are you targeting?

8.1

Which Web server is JCB running on?

2.4

Which Relational Database is JCB running on?

10.6

Which OS is JCB running on?

8

Which JCB version are you using?

3.2.2

Where in JCB did this issue occur?

Installation of a component

On which browsers did you encounter the issue?

Chrome

Additional Comments

No response

### What Happened? is specific situation , constant not loaded and when turn on language debug, then show ??key (joomla constant)?? instead **value (joomla string)** when JCB compile a component and i install that on fresh joomla 4.4.6, then it can not load string. i don't understand this is a bug or not but i can find the problem (I found out after a lot of pain and bleeding): If you have used the enter key on the keyboard (line break) in your expressions for translation (for example, the description of a field), Joomla 4 cannot load all or part of that translation file, and that is because of the existence of INI_SCANNER_RAW In this link: https://github.com/joomla/joomla-cms/blob/4a21f3ee6a8ce3123b56d55ec83d6239530ffd4b/libraries/src/Language/LanguageHelper.php#L425 It is in Joomla 4. This problem did not exist in Joomla 3, and for this reason, our component could correctly load translations in Joomla 3, but it could not in Joomla 4. ### Steps to reproduce the Bug It is enough to use the Enter key instead of using \n for the description part of a field in the settings of one of the component fields. Then compile. See that the page of your component that wants to load that field, cannot load strings. or for simplified the problem, if you do something which result of that like below in the .ini file: COM_MOOJLA_COURSE_SHOWLOGINTAB_LABEL="Show login tab" COM_MOOJLA_COURSE_SHOWREGTAB_DESCRIPTION="If you want the "Register" tab to be displayed in the login / course registration option, select Yes, otherwise No Inherit option uses moojla configuration" COM_MOOJLA_COURSE_SHOWREGTAB_LABEL="Show register tab" COM_MOOJLA_COURSE_SHOW_LABEL_CONTENTS_DESCRIPTION="When check this option shows label activity content exclusive of user enrollment or visibility" COM_MOOJLA_COURSE_SHOW_LABEL_CONTENTS_LABEL="Show label contents" COM_MOOJLA_COURSE_SP_INPUT="Sp Input" COM_MOOJLA_COURSE_STARTDATE_LABEL="startdate" the joomla 4 can not load correctly this file because i use Enter in the value of COM_MOOJLA_COURSE_SHOWREGTAB_DESCRIPTION . ### Which Joomla version are you compiling in? 3.2.2 ### Which PHP version are you compiling in? 8.1 ### Which Joomla versions are you targeting? joomla 4.4.6 ### Which PHP version are you targeting? 8.1 ### Which Web server is JCB running on? 2.4 ### Which Relational Database is JCB running on? 10.6 ### Which OS is JCB running on? 8 ### Which JCB version are you using? 3.2.2 ### Where in JCB did this issue occur? Installation of a component ### On which browsers did you encounter the issue? Chrome ### Additional Comments _No response_
saman2 added the
Bug
label 2024-07-31 13:51:05 +00:00
Owner

you cant use: ant the "Register" tab to be displa inside a language string, I remember Joomla has some kind of workaround for that, but its generally not good idea.

you cant use: `ant the "Register" tab to be displa` inside a language string, I remember Joomla has some kind of workaround for that, but its generally not good idea.
Owner

That means no " in language strings.

Then about the new lines... JCB has a switch to remove new lines in the component:
image

That means no `"` in language strings. Then about the new lines... JCB has a switch to remove new lines in the component: ![image](https://git.vdm.dev/attachments/70717026-f8ae-4b3c-b963-a112291fb5ae)
Author
Member

Thank you
Can you give me an example when maybe need to set "Remove line breaks" set to NO ?

Thank you Can you give me an example when maybe need to set "Remove line breaks" set to NO ?
Owner

well at least you made me chuckle 😄

To be honest when we added it 4 years ago, we could still use [No] most of the times in Joomla 3.... and well I never looked at it again....

We could probably drop the switch and make it always do that.... lol

well at least you made me chuckle 😄 To be honest [when we added it](https://git.vdm.dev/joomla/Component-Builder/commit/d062e03a042f91eb6dac47281e5ad5ec5b9a29de) 4 years ago, we could still use [No] most of the times in Joomla 3.... and well I never looked at it again.... We could probably drop the switch and make it always do that.... lol
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1154
No description provided.