×

Notice

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

TOPIC: Identical files for site and admin

Identical files for site and admin 11 years 10 months ago #19125

  • Detlef Volmer
  • Detlef Volmer's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
Hello,

First of all a gret thank you for this component. This is great and seems to be a great timesaver.

I installed it and it all works fine. But I have a question. In my Joomla! component I use for simplification reasons the same (identical) language file in frontend and backend.

I was not able to create a config file doing that. It always left either one out in the final install manifest file.

Here my interesting parts of the config:
[jpodium.adminen-gbcom_jpodiumini]
file_filter = admin\language\<lang>\<lang>.com_jpodium.ini
source_file = admin\language\en-GB\en-GB.com_jpodium.ini
source_lang = en_GB
 
[jpodium.en-gbcom_jpodiumsysini]
file_filter = admin\language\<lang>\<lang>.com_jpodium.sys.ini
source_file = admin\language\en-GB\en-GB.com_jpodium.sys.ini
source_lang = en_GB
 
[jpodium.siteen-gbcom_jpodiumini]
file_filter = site\language\<lang>\<lang>.com_jpodium.ini
source_file = admin\language\en-GB\en-GB.com_jpodium.ini
source_lang = en_GB

The unfortunate part is that in total three ressources are created on Transifex, but I need only two.

Thank you for any help or advise in this direction.

Regards from Germany

Detlef Volmer

Identical files for site and admin 11 years 10 months ago #19126

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Detlef,
You should not need to copy the same file in the frontend. All you need is the joomla API :)
In your componentname.php file in the frontend you could do (example from hotspots):
$jlang = JFactory::getLanguage();
$jlang->load('com_hotspots', JPATH_ADMINISTRATOR, 'en-GB', true);
$jlang->load('com_hotspots', JPATH_ADMINISTRATOR, $jlang->getDefault(), true);
$jlang->load('com_hotspots', JPATH_ADMINISTRATOR, null, true);

first line loads the admin English file. (this ensures that all strings will have a meaningful translation and not COM_HOTSPOTS_MY_AWESOME_SOMETHING_TEXT...)
the second line loads the language of the site (which can be German for example) And the third line loads the user language. (it can be for example Japanese).

With those 3 lines you can use the same admin language file in the frontend and you don't need to copy files around. 1 location = less things to maintain and less thinks can brake.

Cheers,
Daniel

edit: With this approach you can do even merging. For example you can grab the frontend language file and add it to the backend. Or you can load the files of a module or plugin in your component. Whatever you need...
The following user(s) said Thank You: Detlef Volmer

Identical files for site and admin 11 years 10 months ago #19159

  • Detlef Volmer
  • Detlef Volmer's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
Hi Daniel,

your suggestion works fine and I have now greatly improved my language translation deployment.

Thanks again.

One problem is still there: manually creating the lang packs from the backend works fine. The webhook link instead creates a corrupt file named ".com_jpodium.zip" in the packages/jpodium folder of my media directory.

I copied the URL manually in the browser and got the same results.

I honestly have no idea what's going wrong.

Thank you again

Detlef

Identical files for site and admin 11 years 10 months ago #19161

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Well, I have not experienced that problem with the webhooks here on compojoom, but I also have the feeling that something there is not 100% ok. So far I haven't been able to track it down. With that said I'm starting to think that the webhooks are not the right way to sync the packs. Maybe a cronjob would be better.

Btw - you are welcome to debug and find out why it is not saving the files properly for you. A pull request is after that always welcome: github.com/compojoom/ctransifex

Daniel

Identical files for site and admin 11 years 10 months ago #19168

  • Detlef Volmer
  • Detlef Volmer's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
OK, understood. I'll give it a try over the next weekend.

Detlef
  • Page:
  • 1
Time to create page: 0.108 seconds