Login Form - Changing Constants

Creating and modifying plugins.
Post Reply
codetwists
Regular
Posts: 44
Joined: Sat Dec 20, 2008 5:46 pm

Login Form - Changing Constants

Post by codetwists »

I'm using the Login Plugin. In admin it says it's v1.07, but in the serendipity_plugin_loginform.php it says "serendipity_plugin_loginform.php,v 1.15 2008/08/21 08:37:40"

In line 105 there's a constant NEW_ENTRY.

The plugin has a language file lang_en.inc.php. This language file has no constant NEW_ENTRY.

In the lang/serendipity_lang_en.inc.php there is a constant NEW_ENTRY to which I've assigned the value "New Article".

The problem is that when my page lopads is seems to ignore the constant in lang/serendipity_lang_en.inc.php and uses a value "New Entry" I've searched on both NEW_ENTRY and New Entry and can't find the constant that's being used anywhere. Any idea on where this is coming from?

Thanks,

Myron
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

Did you try changing the lang/UTF-8/serendipity_lang_en.inc.php as well ?
Steve is occasionally blogging here
codetwists
Regular
Posts: 44
Joined: Sat Dec 20, 2008 5:46 pm

Post by codetwists »

sonichouse wrote:Did you try changing the lang/UTF-8/serendipity_lang_en.inc.php as well ?
Actually, no. When I searched on the terms NEW_ENTRY and "New Entry" using the search functions of Macromedia Dreamweaver MX 2004 it only came up with the files I listed in the previous post. I'm wondering a couple of things. First, why would a search not turn up the files in the UTF-8 directory, and second, why does s9y use to complete sets of language files. It seems like the ones in the UTF-8 are redundant, but obviously it's using those instead of the ones in the lang directory.

So why the duplication?

Myron
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
First, why would a search not turn up the files in the UTF-8 directory
That would be a shortcoming of your editor, or maybe you did not check the option "search subdirectories".

Code: Select all

and second, why does s9y use to complete sets of language files.[/quote]

What do you mean? We need complete sets of language files to include all variables needed for a language.

[quote]  It seems like the ones in the UTF-8 are redundant, but obviously it's using those instead of the ones in the lang directory.[/quote]

This depends on which charset you use for your blog. The default for new blog isntallations is UTF-8, but some languages can work fine in ISO-8859-1 for example. Then this "native" format also needs to contain the files.

For english, UTF-8 and ISO is actually the same, but it is easier to derive a UTF-8 version from the ISO file and duplicate the content in our distribution than to add some special if check that does not use UTf-8 subdirectory if the language is english.

Bottom line: You only need to edit the language file of the charset that your blog uses, you can discard the other file.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
codetwists
Regular
Posts: 44
Joined: Sat Dec 20, 2008 5:46 pm

Post by codetwists »

When I installed s9y it created a diretory called lang with a file called serendipity_lang_en.inc.php. It also has a subdirectory UTF-8 with a file called serendipity_lang_en.inc.php. I've added constants to each of the. Sometimes it uses one, sometimes it uses the other. That's pretty confusing. If I understand what you're telling me, I can get rid of the entire UTF-8 directory and it will run fine. Is that correct?

Myron
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
Sometimes it uses one, sometimes it uses the other.
That can't be. It must either always use the file in UTf-8 OR the file in the base directory - as long as you do not change your s9y "charset" configuration option.
That's pretty confusing. If I understand what you're telling me, I can get rid of the entire UTF-8 directory and it will run fine. Is that correct?
The other way round, if your blog runs as UTf-8, you can get rid of the lang/serendipity_lang_en.inc.php file. What's your URL again?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
codetwists
Regular
Posts: 44
Joined: Sat Dec 20, 2008 5:46 pm

Post by codetwists »

garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Okay, your blog runs as UTF-8 (like I suspected) so you actually really only need to edit the file lang/UTF-8/serendipity_lang_en.inc.php.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
codetwists
Regular
Posts: 44
Joined: Sat Dec 20, 2008 5:46 pm

Post by codetwists »

Looks like I'm lacking knowledge on this subject. How can you tell which I'm using? Where can I learn more?

Thanks for your help!

Myron
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Argh.

I'm just noticing that you're not talking about the s9y core but about a specific plugin. I'm sorry.

Plugins behave a bit differently; usually there is no lang_en.inc.php file inside the UTF-8 subdirectory, because usually the plugin loads this file from the root directory of the plugin. So for plugins, you should be fine with only editing the root directories' lang_en.inc.php file.

Actually, the original serendipity_plugin_loginform does NOT have a UTF-8/lang_en.inc.php file, like it should be. If that file exists, it exists because you manually saved a file there. You can delete that, and only do your modifications in the root language file of the plugin.
codetwists wrote:Looks like I'm lacking knowledge on this subject. How can you tell which I'm using? Where can I learn more?
Viewing the HTML sourececode shows me which Charset you have enabled (Content-Type).

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
codetwists
Regular
Posts: 44
Joined: Sat Dec 20, 2008 5:46 pm

Post by codetwists »

Does the application look for language files on the templates directories as well? Since I've created a new page template, if I want to have language constants for it should I create an additional language file or use the existing one in the lang directory?

Myron
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Template language files are more problematic. those need to be loaded from your config.inc.php file of a template (you need to take care of it yourself) and you cannot by default overwrite any existing constants, only add new ones.

You can overwrite existing constants by enabling a "hidden" s9y configuration variable $serendipity['useTemplateLanguage'] = yes inside your serendpity_config_local.inc.php, but then you will loose individual language preference dependant on browser language.

But, like you mention, additional constants are fine.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply