I'd like advice about what the correct way is to edit hardcoded language strings.
Eg. During registration, under the username field, there is the text:

'Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores'

And I like to add more instructions:

'Please use your first name plus your initial. Eg. David.A or Ana.F'

But the string is hardcoded into root/modules/user/user.module

If it is usual practice to hardcode these descriptions, then I'll probably need to edit about 30
of them, to make them suitable for children of various ages who are using english as a
second language.

The spanish translation I downloaded changes the text using a po file.
Is that an option? Could I create a po file to over-ride the system's hardcoded english?

Thanks.

Comments

=-=

the core locale.module and create a site specific language or you can investigate the stringoverrides.module

It should never be a usual practice to hack core files as when you do the next update/upgrade all your changes get overwritten.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

Thanks for your help. So

Thanks for your help.

So string-overrides is as good as it gets?
I don't know; it doesn't seem like the right way to go about it.

But neither does the locale method (it won't work anyway, because my site is already multi-lingual). I assume the localization client: http://drupal.org/project/l10n_client will have the same resource overheads as using the locale method?

I have to say, I'm a little bit surprised that the default language is hard-coded. Wouldn't it have been much better to have been kept in separate po files, like the add-on languages?

I wonder if anyone has created a po translation for the english language, mirroring the default hardcoded strings? Then I could simply edit the po files. When it came to upgrading the language again, I'd simply install the new po files, and 'diff' them with my edited set to sync them.

thanks for any further advice or information.

Everything I say is opinion, even if interpreted as fact.
Sometimes I may be inaccurate or *GASP* wrong!
Sometimes I attack Drupal due to frustration. Get over it.

If the default language is

If the default language is kept in separate po files, what would we use to specify which string to use? atm we use the English string to look-up the translation.

Here is the template for you to make your own ‘translation’ : http://drupal.org/project/drupal-pot
___________________
It’s in the detaιls…

demonstration portfolio

___________________
It’s in the detaιls…

> what would we use to

> what would we use to specify which string to use?

In another CMS I used, the core used 'tags', instead of the actual string.
Eg.
[registrationform-username]
[registrationform-username-description]

Which was then looked-up in the appropriate language file, to obtain:
'User Name'
'Enter your nickname using only alphanumeric....'

Thanks for the link to the translation guide.

But I don't quite understand how this is going to work, because I can't disable the default english:

Eg. If I create a custom language, then there will be three languages enabled - 'english' (default), 'spanish' and 'edited' (custom english). Won't the user only see the 'edited' english if they have chosen it in the language selector?

Also, when creating content, won't the user will see four choices (the 3 languages and 'neutral')?

It doesn't seem like a good solution?
Am I misinterpreting or missing something?
Cheers.

NB:
In theory, theory and practice are identical – It’s only in practice that you notice the gaping chasm.
:) That made me laugh a lot. Thank you.

Everything I say is opinion, even if interpreted as fact.
Sometimes I may be inaccurate or *GASP* wrong!
Sometimes I attack Drupal due to frustration. Get over it.

...

Have you tried deactivating the default english? Deactivating it works fine on my test site. I haven't tried it on mulitlingual sites, though, only on monolingual non-English ones, but I assume it would work.

thanks, but....

1)
> Have you tried deactivating the default english?
> The default language cannot be disabled, but can be hidden; ie. not presented as an option, if required.

Thanks. That was new information. I'd assumed because the 'english' checkbox was greyed out that it could not be disabled. So of course I found out that it could be disabled by choosing 'spanish' as the default. However...

Once disabled, I tried creating a custom language, so I could use po files for english (to replace the hardcoded version). But Drupal would not let me create a custom language with the code or path 'en', even though the core language was disabled.

Any thoughts?

2)
Before I disabled the core english, when I clicked 'english' in the language selector, en was added to the url, and after clicking 'spanish' it was replaced by es in the url. However, even though all the settings are back to the way they were, choosing 'english' in the language selector does not display any path prefix in the url. I'd really like that back the way it was working before!

Any ideas?

Everything I say is opinion, even if interpreted as fact.
Sometimes I may be inaccurate or *GASP* wrong!
Sometimes I attack Drupal due to frustration. Get over it.

… so why is it that practice makes you perfect?

Using tags with name-spaces – as you point out – is one solution; but, like it or not, English (American) is the de facto language of the internet – whatever the country; so it makes sense to use this as the default.

This possibly means that other languages suffer a performance penalty, and maybe one day this will be addressed, by a solution similar to that which you propose, that puts all languages on an equal footing.

Your application stops short of requiring a whole separate language, but a modification of some of the strings; and there are solutions for this, detailed in these comments. Although modified, this will still be the default language, and it will be the only language. If you also have a multi-lingual site, I think the un-modified strings will still be used for translations (please check this, though), otherwise you would need to provide translations of your modifications as well.

The default language cannot be disabled, but can be hidden; ie. not presented as an option, if required.

I don’t know where neutral came from…

PS. -Anti- Have you noticed the joke in the sig. below?…
___________________
It’s in the detaιls…

demonstration portfolio

___________________
It’s in the detaιls…

> like it or not, English

> like it or not, English (American) is the de facto language of the internet

Yep, but hardcoding it makes it difficult to edit, whilst it is easy to edit the additional languages.
I don't mind what the default language actually is, just suprised that it was implemented in a
way that makes it difficult to change.

> I don’t know where "neutral" came from…

When I create content, the language drop down has 'english', 'spanish' and 'language neutral'.
Is that not normal? I'd love to get rid of that totally unecessary 'neutral' option and only have
'english' and 'spanish', if possible!? I can't think of a single use for having a 'neutral' option -
it just makes Views and filters harder.

Everything I say is opinion, even if interpreted as fact.
Sometimes I may be inaccurate or *GASP* wrong!
Sometimes I attack Drupal due to frustration. Get over it.

Or see the last few lines of

Or see the last few lines of your sites/…/settings.php file.
___________________
It’s in the detaιls…

demonstration portfolio

___________________
It’s in the detaιls…