[wp-hackers] What do you name the localization .mo when the locale is not set?

Frank Bueltge frank at bueltge.de
Thu Jun 17 15:31:33 UTC 2010


$locale_file is only interestet for use the subfolder with a php-file for
custom functions for a language
Example: in my language we have special strings ä ü ö etc. and WordPress has
on default problems with this. When active the language de_DE, then i will
include the de_DE.php for remove this problems and include my functions.
This problem give it in many languages and WordPress has the same function
for the translation-files on core in folder wp-content/languages


On Thu, Jun 17, 2010 at 5:19 PM, Wordpress Developer <
wordpress.development at gmail.com> wrote:

> Thanks Frank! I've seen code like that in the past. I haven't seen an
> explanation of what /langages/$locale.php does. I don't think I have a file
> like this in my theme. I can't get your code working for me yet but I'm
> optimistic. Can you tell me what it does and why I need it?
>
>
> On Thu, Jun 17, 2010 at 8:12 AM, Frank Bueltge <frank at bueltge.de> wrote:
>
> > A small example, works fine.
> > i have this in a function and hook this on init (WordPress smaller
> > 3.0) and greater
> > than or equal WP 3.0 via hook after_setup_theme.
> >
> >    define( 'FB_GREYFOTO_TEXTDOMAIN', 'photoblog' );
> >
> >    if ( defined( 'WPLANG') )
> >        $locale = WPLANG;
> >    if ( empty($locale) )
> >        $locale = 'en_US';
> >    load_theme_textdomain( FB_GREYFOTO_TEXTDOMAIN );
> >    $locale = get_locale();
> >    $locale_file = TEMPLATEPATH . '/languages/' . $locale . '.php';
> >    if ( is_readable( $locale_file ) )
> >        require_once( $locale_file );
> >
> >
> > On Thu, Jun 17, 2010 at 5:02 PM, Wordpress Developer <
> > wordpress.development at gmail.com> wrote:
> >
> > > I'm working on a localized template and have my .mo working fine for
> > > default
> > > installs of WP. Love it: Just use _e('whatever', 'textdomain') and it
> > echos
> > > out the value based on the "whatever" key.
> > >
> > > Unfortunately, my code fails after taking it from my personal dev
> > > environment into a professional one. I've troubleshooted what I can and
> > > think it's because the locale is not set on the new dev environment. I
> > ran
> > > this code to check:
> > >
> > > <?php
> > > $locale = get_locale();
> > > if($locale == "en_US") {
> > >   echo "english: $locale";
> > > } else { echo "not english: $locale"; } ?>
> > >
> > > In the working dev environment, it echos out "english: en_US"
> > >
> > > In the non-working dev environment, it echos out "not english: "
> > >
> > > In both installs the WP_Lang constant is not set (wp-config: "define
> > > ('WPLANG', '');"). It's a bit confusing to me as to why one install
> > > defaults
> > > to en_US (as I might expect) but the other doesn't seem to have the
> > locale
> > > set at all. In any case, I suspect my .mo is failing because it's named
> > > en_US.mo in the theme folder and since the locale on the second setup
> is
> > > not
> > > en_US it's not finding it.
> > >
> > > In any case, I figure my .mo has a chance if I name it the right thing
> > for
> > > a
> > > WP install with no language set. Is there such a namespace? What do you
> > > name
> > > the localization .mo when the locale doesn't seem to be set?
> > >
> > > Thank you!
> > > _______________________________________________
> > > wp-hackers mailing list
> > > wp-hackers at lists.automattic.com
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list