×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Location of liveupdate.ini

Location of liveupdate.ini 10 years 11 months ago #20540

  • Joerg
  • Joerg's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 1
Extension developers who use the Akeeba Live Update, usually place the xx-XX.liveupdate.ini into a folder like in the following examples:

domainname\administrator\components\com_ctransifex\liveupdate\language
domainname\administrator\components\com_virtuemart\liveupdate\language
domainname\administrator\components\com_akeeba\liveupdate\language

I suppose this makes sense, because extensions may use a customized version of the Akeeba Live Update system, including a slightly different xx-XX.liveupdate.ini.

Any idea how to instruct ctransifex to include the full path of the xx-XX.liveupdate.ini in the generated zip file? I've tried to add the full path in the Transifex config file - in my case:

file_filter = translations/administrator/components/com_virtuemart/liveupdate/language<lang>/<lang>.liveupdate.ini

This works with the Windows tx client, but using ctransifex the path for this file in the generated zip always is the Joomla admin language folder.

Location of liveupdate.ini 10 years 11 months ago #20558

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
That is interesting problem. Currently ctransifex can only package the language files of 1 extension & it tries to automatically figure out where to put the files:
github.com/compojoom/ctransifex/blob/mas...pers/package.php#L28

With the current code there is no way to put the liveupdate in the folder you want. Care to submit a pull request?

Daniel

Location of liveupdate.ini 10 years 11 months ago #20567

  • Joerg
  • Joerg's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 1
Hi Daniel,
unfortunately I'm not a coder (php illiterate), so I'm unable to write code for a pull request. But maybe somebody else can take care of this... :)

Location of liveupdate.ini 10 years 10 months ago #21343

  • Lyr!C
  • Lyr!C's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 1

Joerg wrote: Hi Daniel,
unfortunately I'm not a coder (php illiterate), so I'm unable to write code for a pull request. But maybe somebody else can take care of this... :)


Don't know if you have found the solution, but if not, there is one :

In ROOT/administrator/components/com_ctransifex/helpers/package.php

Replace this :
$adminPath = JPATH_ROOT . '/media/com_ctransifex/packages/'.$project->transifex_slug.'/'.$jLang.'/admin/';
        $frontendPath = JPATH_ROOT . '/media/com_ctransifex/packages/'.$project->transifex_slug.'/'.$jLang.'/frontend/';
 
        if(in_array('admin', $fileFilter) || in_array('administrator', $fileFilter) || in_array('backend', $fileFilter)) {
            $path = $adminPath.$fileName;
        }
        else {
            $path = $frontendPath.$fileName;
        }

By this :
$adminPath = JPATH_ROOT . '/media/com_ctransifex/packages/'.$project->transifex_slug.'/'.$jLang.'/admin/';
        $frontendPath = JPATH_ROOT . '/media/com_ctransifex/packages/'.$project->transifex_slug.'/'.$jLang.'/frontend/';
 
        if(in_array('admin', $fileFilter) || in_array('administrator', $fileFilter) || in_array('backend', $fileFilter)) {
            $path = $adminPath.$fileName;
        }
        elseif (in_array('liveupdate', $fileFilter)){
            $path = $filePath.$fileName;
        }
        else {
            $path = $frontendPath.$fileName;
        }

Replace this :
if(JFolder::exists($folder.'/admin')) {
                JFolder::delete($folder.'/admin');
            }
            if(JFolder::exists($folder.'/frontend')) {
                JFolder::delete($folder.'/frontend');
            }
            if(JFile::exists($folder.'/install.xml')) {
                JFile::delete($folder.'/install.xml');

By this :
if(JFolder::exists($folder.'/admin')) {
                JFolder::delete($folder.'/admin');
            }
            if(JFolder::exists($folder.'/frontend')) {
                JFolder::delete($folder.'/frontend');
            }
            if(JFolder::exists($folder.'/liveupdate')) {
                JFolder::delete($folder.'/liveupdate');
            }
            if(JFile::exists($folder.'/install.xml')) {
                JFile::delete($folder.'/install.xml');

And then, Replace this :
$admin = self::getFiles($folder . '/admin');
 
        if($admin) {
            $adminFiles = '<files folder="admin" target="administrator/language/'.$jLang.'">'.$admin.'</files>';
        }
        $content = str_replace('@@ADMIN_FILENAMES@@', $adminFiles , $content);
        $frontend = self::getFiles($folder . '/frontend');
 
        if($frontend) {
            $frontendFiles = '<files folder="frontend" target="language/'.$jLang.'">'.$frontend.'</files>';
        }
        $content = str_replace('@@FRONTEND_FILENAMES@@', $frontendFiles, $content);
 

By this :
$admin = self::getFiles($folder . '/admin');
 
        if($admin) {
            $adminFiles = '<files folder="admin" target="administrator/language/'.$jLang.'">'.$admin.'</files>';
        }
        $content = str_replace('@@ADMIN_FILENAMES@@', $adminFiles , $content);
        $frontend = self::getFiles($folder . '/frontend');
 
        if($frontend) {
            $frontendFiles = '<files folder="frontend" target="language/'.$jLang.'">'.$frontend.'</files>';
        }
        $content = str_replace('@@FRONTEND_FILENAMES@@', $frontendFiles, $content);
        $liveupdate = self::getFiles($folder . '/liveupdate');
 
        if($liveupdate) {
            $liveupdateFiles = '<files folder="admin" target="administrator/components/COM_NAME_OF_YOUR_COMPONENT/liveupdate/language/'.$jLang.'">'.$liveupdate.'</files>';
        }
        $content = str_replace('@@LIVEUPDATE_FILENAMES@@', $liveupdateFiles , $content);

Don't forget to replace COM_NAME_OF_YOUR_COMPONENT ;)

You can do the same last change in ROOT/administrator/components/com_ctransifex/controllers/packager.raw.php

Then last edit in ROOT/administrator/components/com_ctransifex/assets/install.xml

Replace this :
<fileset>
        @@ADMIN_FILENAMES@@
        @@FRONTEND_FILENAMES@@
    </fileset>
By this :
<fileset>
        @@ADMIN_FILENAMES@@
        @@FRONTEND_FILENAMES@@
	@@LIVEUPDATE_FILENAMES@@
    </fileset>

Then, in your Transifex config (added too in ctransifex), for file_folder, declare this :
SOURCE/liveupdate/language/<lang>/<lang>.liveupdate.ini

Hope this could help! B)

Note: this can be implement in a generic way, but it should maybe have to reconsider naming for frontend (as for admin, use of 'site' or 'frontend' and maybe not use of administrator to be able to use it in path for none language core folder)

Location of liveupdate.ini 10 years 10 months ago #21346

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Wow, that is interesting! I will have a look at this again for the next update :)
Thanks!

Location of liveupdate.ini 10 years 10 months ago #21369

  • Lyr!C
  • Lyr!C's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 1

Daniel Dimitrov wrote: Wow, that is interesting! I will have a look at this again for the next update :)
Thanks!


I've just discovered your component, and i think it's a good project !
Really interresting, and promissing!

I'm a developper too, of extensions, so i've got ideas for this component (but not always time!)

About liveupdate files, what can be done is to set "standard" in file_folder tags.

For example, using "administrator" is not good, because it is a joomla core folder.

I think, we can use exactly as it is for joomla language packs : "admin" and "site".

So that, we can add a function, if "admin" or "site" not found, to use the path indicated in file_folder tag.

Something like this :
        if (in_array('admin', $fileFilter)) {
            $path = $adminPath.$fileName;
        }
        elseif (in_array('site', $fileFilter)){
            $path = $frontendPath.$fileName;
        }
        else {
            $path = $filePath.$fileName; // (or only $filePath, if use of all file_folder tag, but getting file path without filename can help to use filepath as target in xml)
        }

Where file path is the path wanted by user for a specific file, in config file.

For example :
file_filter = administrator/components/com_XXX/liveupdate/language/<lang>/<lang>.liveupdate.ini
source_file = administrator/components/com_XXX/liveupdate/language/en-GB/en-GB.liveupdate.ini
host = https://www.transifex.com
source_lang = en_GB


Like this, you can add file everywhere you need (for example, in a module folder, to be able to replace missing strings in a module, by english strings)
;)
The following user(s) said Thank You: Paulo Pereira
  • Page:
  • 1
Time to create page: 0.216 seconds