Discussion:
Simplest way to create a custom language pack for the purpose of markup only?
Aahan Krish
2014-02-20 16:35:58 UTC
Permalink
Hello,

I'd like to create a language pack, en_IN i.e., Indian English, based on
the default WordPress language (en_US). All I need is the markup `en-IN` or
`en_IN` instead of the defaults (`en-US` or `en_US`) where appropriate.

For e.g.

<html lang="en-IN">

Instead of:

<html lang="en-US">

And, another instance:

<meta property="og:locale" content="en_IN">

instead of:

<meta property="og:locale" content="en_US">

So, what'd be the simplest way to create a language pack so that it has the
same translation string definitions as en_US, but outputs the right
language attribute values (`en-IN` or `en_IN` depending on the attribute)?

Thanks!
Aahan Krish
2014-02-24 19:11:06 UTC
Permalink
Hmm... anyone?
Nikola Nikolov
2014-02-24 19:15:03 UTC
Permalink
Why don't you just add

define( 'WPLANG', 'en_IN' );

to your wp-config.php file?
This should change the result of get_locale() - which should be used in the
basis of all functions that you described above - and unless you already
have a translation file for en_IN, then all strings will remain the same as
the original strings(which are all in en_US).
Post by Aahan Krish
Hmm... anyone?
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Aahan Krish
2014-02-24 19:50:22 UTC
Permalink
Hello Nikola,

I should have clarified that I am using WordPress Multisite, and as there's
only one wp-config.php file, I don't think it's possible. Or is it?
From what I read, in my given case (WordPress Multisite) I need the
language files to enable a specific language via the individual site's
settings in the network admin.
Otto
2014-02-24 21:06:14 UTC
Permalink
Post by Aahan Krish
Hello Nikola,
I should have clarified that I am using WordPress Multisite, and as there's
only one wp-config.php file, I don't think it's possible. Or is it?
From what I read, in my given case (WordPress Multisite) I need the
language files to enable a specific language via the individual site's
settings in the network admin.
WPLANG is settable on a per-site basis in multisite. Just go to the
/wp-admin/network, Sites->All Sites, pick your site from the list and
click the "Edit" link, go to the Settings tab for that site, and
scroll down until you find the WPLANG setting. Same setting, same type
of values.

Then just name your files appropriately in the wp-content/languages directory.

-Otto
Aahan Krish
2014-02-25 03:46:49 UTC
Permalink
Hello Otto,

WPLANG option in the individual site settings in network admin won't save
until there are necessary language files. Hence the question, what's the
simplest way to create language files?

Can I simply download the UK English (en_GB) version of WordPress and
simply replace all instances of en_GB in the language file names (files
residing in wp-content/languages) with en_IN? Is that sufficient?

If yes (to the question right above), where can I get the language files
for en_US? I'd prefer US English to UK English in the dashboard; I am used
to it.
Otto
2014-02-25 06:26:09 UTC
Permalink
Post by Aahan Krish
WPLANG option in the individual site settings in network admin won't save
until there are necessary language files. Hence the question, what's the
simplest way to create language files?
The simplest way would be to contribute to the existing translations:
http://translate.wordpress.org

Alternatively, get the POT files and use your own po-editing tool of
choice to make a translation yourself:
http://i18n.svn.wordpress.org/pot/tags/3.8/
Post by Aahan Krish
Can I simply download the UK English (en_GB) version of WordPress and
simply replace all instances of en_GB in the language file names (files
residing in wp-content/languages) with en_IN? Is that sufficient?
Yes, it's simply reading the filenames to determine what languages are
installed.
Post by Aahan Krish
If yes (to the question right above), where can I get the language files
for en_US? I'd prefer US English to UK English in the dashboard; I am used
to it.
There is no set of en_US files, as that's the fallback position. It's
what is translated from, not to.

-Otto
Nikola Nikolov
2014-02-25 08:37:13 UTC
Permalink
Actually, install and activate Codestyling
Localization<http://wordpress.org/plugins/codestyling-localization/>on
your WordPress site. Then go to Tools > Localization and click on the
"Add new language" button that is across from "WordPress".
Select your language(en_IN - I assume it's existing, but I haven't
checked). Once it's created click on the "Rescan" button across from the
language - it opens a pop-up and you click "scan now".
Once that's done, click on the "Edit" button across from the language.
This will take you to the screen where you can translate all the strings.
Make a simple change - for instance click "edit" on the first string you
see and copy/paste the text in the "Original" textarea to the "Translation"
textarea. On top of the screen, click on the "generate mo-file", which will
generate the correct mo-file for you, but it will pretty much be blank.

That should be it - the file should be saved in the proper location and now
you should be able to use en_IN in your site.

Hmmm - I just checked the plugin and it doesn't seem to support en_IN. You
can probably still use this approach and then just rename the .mo file(you
might have to look at the file and see if there is locale information in
it).
Post by Otto
Post by Aahan Krish
WPLANG option in the individual site settings in network admin won't save
until there are necessary language files. Hence the question, what's the
simplest way to create language files?
http://translate.wordpress.org
Alternatively, get the POT files and use your own po-editing tool of
http://i18n.svn.wordpress.org/pot/tags/3.8/
Post by Aahan Krish
Can I simply download the UK English (en_GB) version of WordPress and
simply replace all instances of en_GB in the language file names (files
residing in wp-content/languages) with en_IN? Is that sufficient?
Yes, it's simply reading the filenames to determine what languages are
installed.
Post by Aahan Krish
If yes (to the question right above), where can I get the language files
for en_US? I'd prefer US English to UK English in the dashboard; I am
used
Post by Aahan Krish
to it.
There is no set of en_US files, as that's the fallback position. It's
what is translated from, not to.
-Otto
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Aahan Krish
2014-02-25 10:09:46 UTC
Permalink
Hello Otto,
Post by Otto
http://translate.wordpress.org
I don't Indian English applies to the web. Indian English differs in the
day-to-day stuff that we hear, for example, we call it "godown" whereas in
American English it'd probably be "warehouse". If there was any meaningful
way of translating WordPress to Indian English, I'd have tried. =)

Hello Nikola,
Post by Otto
Actually, install and activate Codestyling
Localization<http://wordpress.org/plugins/codestyling-localization/>on
your WordPress site.
I'll give it a shot today.

Thank you, to the two of you!

Loading...