We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Overriding $LANG variables?

Development and Programming

Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue

I’m a little stumped here. I’m trying to customize the “category” language with an extension. Often I use categories in a very specific way - in this example, each category is a music genre.

I figured it would be easy. I used the show_full_control_panel_start hook, and did this as a test:

global $LANG;
$LANG->language['categories'] = "genres";

Nope, didn’t work. I double-checked the categories tab in the source, and its label is sure enough generated by $LANG->line(‘categories’); So I did this in the same hook:

print_r($LANG->language)

And lo and behold, the variable was changed as I wanted:

['categories'] => 'genres'

But still no joy on the changes actually being reflected in the publish form. So I added another method on the show_full_control_panel_end hook, to see if my changes stayed in effect after the page was built:

echo $LANG->line('categories');

Surprisingly, my change was still there.

So, how could I be setting this language variable at show_full_control_panel_start, and successfully echoing it at show_full_control_panel_end, but have it not be affecting the output of that variable in-between the two hooks?

Any ideas? I thought maybe there was some JavaScript at play manipulating the output, so I disabled JS as well, but to no avail.

       
lebisol's avatar
lebisol
2,234 posts
16 years ago
lebisol's avatar lebisol

no clue about ext. development but can’t you change it CP Home › Admin › Weblog Administration › Global Weblog Preferences
sorry if this is a dumb contribution.

       
Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue

Nope - that’s just the category url trigger you can change there, which I’m also doing. 😊

       
lebisol's avatar
lebisol
2,234 posts
16 years ago
lebisol's avatar lebisol

anything of use in CP Home › Admin › Utilities › Translation Utility

       
Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue

Haha, wow, you learn something new every day. I have never looked at that Utility before, nor was I familiar with the /translations/ directory. Thanks for pointing me there.

However, even this appears to have no effect on the language used on the publish page. Which makes me think that this is actually a bug of some kind.

       
lebisol's avatar
lebisol
2,234 posts
16 years ago
lebisol's avatar lebisol

Sorry I am not of more help - this is all I can share 😊

       
Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue

Correction: moving the updated file from the /translations/ folder into the /languages/english/ folder does indeed update the strings.

However, doing it via an Extension would be much easier to maintain, especially through EE updates.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

Or just create a custom language pack….

       
Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue

Just looked at the docs, and it appears as though a custom language pack is able have only a small number of strings, with the rest defaulting to English. If so, this could be the ticket for me. Thanks!

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

Yep, you would just “translate” what you need to and leave the rest.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.