No Code Attached Yet Information Required
avatar cappuccinonet
cappuccinonet
27 Sep 2023

Steps to reproduce the issue

When programming a component for an API in Joomla 4, the config contains the following language file definitions:

<api>
    <files folder="api">
        <folder>src</folder>
    </files>
    <languages folder="api">
        <language tag="en-GB">language/en-GB/com_mycomponent.ini</language>
        <language tag="en-GB">language/en-GB/com_mycomponent.sys.ini</language>
    </languages>
</api>

The component installs without errors, but the language files in the folder /api/language/en-GB/* of the component aren't copied to the folder /api/language/en-GB/ as described here https://www.dionysopoulos.me/book/com-lang.html.

When I copy the language files manually, they are interpreted correctly. Languages other than en-GB do not seem to work.

Expected result

All language files within the element should be copied to the /api/language folder.

Actual result

System information (as much as possible)

Joomla 4.3.4

Additional comments

Votes

# of Users Experiencing Issue
0/1
Average Importance Score
4.00

avatar cappuccinonet cappuccinonet - open - 27 Sep 2023
avatar cappuccinonet cappuccinonet - change - 27 Sep 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 27 Sep 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Sep 2023
avatar Fedik
Fedik - comment - 27 Sep 2023

All language files within the element should be copied to the /api/language folder.

Not really. It was like that long time ago.

Nowaday all language files should be within component:
for Site components/com_example/language,
for API api/components/com_example/language,
for Administrator administrator/components/com_example/language,

Same for Plugins and Modules

avatar brianteeman
brianteeman - comment - 27 Sep 2023

@Fedik sorry that is not correct

avatar richard67
richard67 - comment - 27 Sep 2023

@cappuccinonet Could you post the content of the manifest XML of that component?

avatar cappuccinonet cappuccinonet - change - 27 Sep 2023
The description was changed
avatar cappuccinonet cappuccinonet - edited - 27 Sep 2023
avatar cappuccinonet
cappuccinonet - comment - 27 Sep 2023

@richard67 Just fixed the markup to show up the code.
Before opening this thread I posted the question on Stackexchange


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41944.
avatar richard67
richard67 - comment - 27 Sep 2023

Where in the zip file of the package are the language files located? Reading this answer on Stackexchange I would assume they are located inside the "api" folder in the zip, not in a subfolder of that. Or do you have them inside folder "api/language" in the zip, and the "api" folder is at the first level inside the zip? Then your XML should be:

<api>
    <files folder="api">
        <folder>src</folder>
    </files>
    <languages folder="api/language">
        <language tag="en-GB">language/en-GB/com_mycomponent.ini</language>
        <language tag="en-GB">language/en-GB/com_mycomponent.sys.ini</language>
    </languages>
</api>

Not sure if that will work, but that's how I understand that answer on Stackexchange.

avatar cappuccinonet
cappuccinonet - comment - 27 Sep 2023

They are located here:

<extension> 
   ...
   <namespace path="src">MyCompany\Component\MyExtension</namespace>
   ...
   <administration>
      <files folder="admin">
         ...
      </files>
      <languages folder="admin">
        <language tag="en-GB">language/en-GB/com_mycomponent.ini</language>
        <language tag="en-GB">language/en-GB/com_mycomponent.sys.ini</language>
      </languages>
   <administration>
   ...
   <api>
      <files folder="api">
         <folder>src</folder>
      </files>
      <languages folder="api/language">
         <language tag="en-GB">language/en-GB/com_mycomponent.ini</language>
         <language tag="en-GB">language/en-GB/com_mycomponent.sys.ini</language>
      </languages>
   </api>
   ...
</extension>
```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/41944">issues.joomla.org/tracker/joomla-cms/41944</a>.</sub>
avatar cappuccinonet
cappuccinonet - comment - 27 Sep 2023

The files itself are located inside the zip like this:

/admin/language/en-GB
/api/language/en-GB

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41944.
avatar brianteeman
brianteeman - comment - 27 Sep 2023
      <languages folder="api/language">
         <language tag="en-GB">en-GB/com_mycomponent.ini</language>
         <language tag="en-GB">en-GB/com_mycomponent.sys.ini</language>
      </languages>
avatar cappuccinonet
cappuccinonet - comment - 27 Sep 2023

@brianteeman I tried that too, but it failed to work.


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

avatar Fedik
Fedik - comment - 27 Sep 2023

Fedik sorry that is not correct

I mean, it what is prefered.
You just place your language under component, and all works:

<administration>
  <files folder="admin">
    <folder>language</folder>
    ...    
  </files>
<administration>

<api>
  <files folder="api">
      <folder>language</folder>
      ...
  </files>
</api>

<files folder="site">
  <folder>language</folder>
  ...
</files>

There was a discussion here some years ago, but it will be hard to find.
No practical reasons to place extension language files globally.

avatar Fedik
Fedik - comment - 27 Sep 2023

I tried that too, but it failed to work.

What @brianteeman suggested should work, maybe one of paths is incorect,
you also can try other way around:

<api>
      <files folder="api">
         <folder>src</folder>
      </files>
      <languages folder="api">
         <language tag="en-GB">language/en-GB/com_mycomponent.ini</language>
         <language tag="en-GB">language/en-GB/com_mycomponent.sys.ini</language>
    </languages>
</api>

But I would suggest to try what I wrote in previous comment, it much more clean and easy.

avatar heelc29
heelc29 - comment - 25 Mar 2024

@cappuccinonet Could you please test #43152?

avatar richard67 richard67 - change - 25 Mar 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-03-25 15:13:35
Closed_By richard67
Labels Added: Information Required
avatar richard67 richard67 - close - 25 Mar 2024
avatar richard67
richard67 - comment - 25 Mar 2024

Closing as having a pull request. Please test #43152 . Thanks in advance.

Add a Comment

Login with GitHub to post a comment