• Page:
  • 1
  • 2

TOPIC:

Custom language files 9 years 3 weeks ago #1

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
Can I ask a silly question?

In PGV we could create an extra.en file in which we could put our own phrases. Does this facility exist in webtrees and if so how do we do it?

If not can someone help me to use this '<!ATTLIST xml:space (default|preserve) 'preserve'>'. How does it work and where do I put it? (politely!) in order to force the browser to respect white space.

You probably guessed I am playing with the reports and am having trouble with white space. I could probably crack it within my own phrases.

Regards

John H
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Last edit: by kiwi.

Re: Custom language files 9 years 3 weeks ago #2

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 13364
<<Does this facility exist in webtrees and if so how do we do it?>>

Yes. See wiki.webtrees.net/Custom_Translation
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #3

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
OK Thanks Greg.
I created a .po file with a couple of entries to try it using betterpoeditor.
"he resided at" I translated to "He lived in ~ ". to make it more readable and the tilda to separate the address from the "in".

My en_GB.mo file is in hawthornthwaite.net/webtrees/data/language/ directory, but it isn't being read by the reports. At least I still get "He resided at".

Any suggestions?

John H
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #4

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 13364
<<Any suggestions?>>

The translation library uses a lot of caching.

Either clear the cache files (from your system temp folder?), or wait 2 (?) hours.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #5

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
Greg,

Donethat, no effect. This is the .po file. Is it OK?

msgid ""
msgstr ""
"Project-Id-Version: webtrees\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-Language: en\n"
"X-Poedit-Country: GB\n"
"X-Poedit-SourceCharset: utf-8\n"

msgid "He resided at"
msgstr "He lived at ~ "

msgid "She resided at"
msgstr "She lived at ~ "
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #6

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
I forgot to say that it takes about 10 to 15 seconds to produce the pdf report and 5 to 10 seconds for the html report.

J
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #7

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
OK.
I've been taking it one step at a time. The following code is not doing the translation bit but is merely putting the original text into the report.
<var var="WT_I18N::translate('She lived in')". I tried changing the .po file translation to no effect so I changed the text in the variable and that change went into the report. All changes made to the text in the variable ae going into the report and ignoring the translate command.


I know that reports are low priority, but I have the bit between my teeth and I would be grateful if I could continue this thread. I'm learning all the time.
John H
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #8

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 13364
@John - I haven't looked at this code, but from what you have posted:

The code contains

WT_I18N::translate('She lived in')

Therefore you need to translate this string. However, in your PO file, you translate a completely different string.

msgid "She resided at"
msgstr "She lived at ~ "

The msgid part must be the same as the argument to translate()
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Do you need a web hosting solution for your webtrees site?
If you prefer a host that specialises in webtrees, the following page lists some suppliers able to provide one for you: 

Re: Custom language files 9 years 3 weeks ago #9

I've added notes in the wiki about these two issues (need to translate original code; and clearing cache).
Nigel

www.our-families.info

Hosted at:
Follow me at:

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #10

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
I am pathetic!

I shall go to bed, let the cache empty and try it again tomorrow with the proper strings in the .po file. I'll report back.

I may have solved the overprinting isuue but will test to destruction before going public. xml seems to be very sensitive to carriage returns within text tags.

Regards
John H
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #11

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
Good morning both.

My webtrees doesn't translate. It puts into the report exactly what there is in the xml. I created the .mo file from the .po below. If I change the xml and also the msgid to match, but leave the msgstr as was, it puts the changed variable into the report not the msgstr.

msgid ""
msgstr ""
"Project-Id-Version: webtrees\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-Language: en\n"
"X-Poedit-Country: GB\n"
"X-Poedit-SourceCharset: utf-8\n"

msgid "He lived in"
msgstr "He lived in "

msgid "She lived in"
msgstr "She lived in "

<if condition="$gender=='m'"><var var="WT_I18N::translate('He lived in')" /></if>
<if condition="$gender=='f'"><var var="WT_I18N::translate('She lived in')" /></if>

Changing the var to
<if condition="$gender=='m'"><var var="WT_I18N::translate('He drank in' )" /></if>

and the msgid to 'He drank in' and leaving the msgstr as 'He lived in' will put 'He drank in' into the report.

Regards
John H
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #12

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 13364
Hi John,

As a quick test, I took the ancestors report, which contains the text "He was buried".

I created a CSV language file data/language/en_GB.csv containing

"He was buried";"He was interred"

I ran the report again - and still saw "He was buried".

So I then cleared the cache files - which on my server are /tmp/zend_cache*

I ran the report again, and this time I see "He was interred".

So - the custom-translation process definitely works with reports. It not obvious what you might be doing wrong.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #13

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
OK Greg, I'll have another go.

J
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #14

It looks like the problem is a lack of understanding of the po/mo file file translation system (no offence intended, John). That is the most complicated option you could have chosen of the three. I don't understand it very well either, so I avoid using them :-)

But your example below perhaps explains the problem you are having:
msgid "He lived in"
msgstr "He lived in "
That appears to be trying to change "He lived in" to "He lived in" - which is no change at all!!

I wonder why you are using po/mo files? The reasons for using them are in the WIKI, so unless they apply, I would suggest you stick to a simple php or csv file, as per Greg's example. At the very least, start simple, and perhaps when you have got the hang of it, then experiment with the more complex solutions.
Nigel

www.our-families.info

Hosted at:
Follow me at:

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #15

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
Thanks Nigel. I don't feel offended at all.
I have put the code back to it's original and the variables are shown below.

Also shown are the .po file which was compiled and uploaded and also the csv file which is also uploaded, both to the data/language directory. I have cleared the cache directory. The variables are not translated. Does the csv need any preamble like the PO file?

I'm sorry to give you hassle for something which I know is really low down on yr list of things to do.


<var var="WT_I18N::translate('He resided at')" />
<var var="WT_I18N::translate('She resided at')
<var var="WT_I18N::translate('His occupation was')" />
<var var="WT_I18N::translate('Her occupation was')" />

.PO
msgid ""
msgstr ""
"Project-Id-Version: webtrees\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-Language: en\n"
"X-Poedit-Country: GB\n"
"X-Poedit-SourceCharset: utf-8\n"


msgid "He resided at"
msgstr "He lived in "

msgid "She resided at"
msgstr "She lived in "

msgid "His occupation was"
msgstr "He was employed as a "

msgid "Her occupation was"
msgstr "She was employed as a "

CSV
"He resided at";"He lived in "
"She resided at";"She She lived in "
"His occupation was";"He was employed as a "
"Her occupation was";"She was employed as a "
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #16

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 13364
John - have you relocated your data directory? If so, are you putting the translation files in the right place?
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 3 weeks ago #17

Greg, as an aside to Johns issue, aren't the translations he is trying to achieve actually better en-GB translations than we currently have anyway?
Nigel

www.our-families.info

Hosted at:
Follow me at:

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 2 weeks ago #18

  • vito
  • vito's Avatar
  • Visitor
  • Visitor
I have made few suggestions on croatian translation about 15 days ago, and I'm still waiting for approval. How long is it take to approve language translation suggestions in launchpad?

Thanx, and sorry for OT..

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 2 weeks ago #19

  • Hagershorn
  • Hagershorn's Avatar Topic Author
  • Offline
  • New
  • New
  • Posts: 98
Hi both,

my .mo files are in /webtrees/language directory, which was what was set up when I upgraded to 1.2.1
My "extra" .mo file is in /webtrees/data/language directory. My cache files are in /webtrees/data/tmp directory.

I have emptied the cache files regularly. Perhaps I shouldn't have??

Regards

J
John H
Windows 7 webtrees 1.7.2
8Gb ram, 3.9GHz quad core, mysql 5.5.32 php 5.3.3 Apache 2.2.14
www.hawthornthwaite.net/webtrees
John H

Please Log in or Create an account to join the conversation.

Re: Custom language files 9 years 2 weeks ago #20

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 13364
<<my .mo files are in /webtrees/language>>

The default/distribution files live in this directory.

Your custom files should live in /webtrees/data/language/

This arrangement means that when you upgrade to a newer version of webtrees, it does not overwrite your local translations.

So, your local translations in /webtrees/data/language/en_GB.mo (or en_GB.csv or en_GB.php) will overwrite the "official" translations in /webtrees/language/en_GB.mo
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Powered by Kunena Forum