Netgate SG-1000 microFirewall

Author Topic: pfSense® software translations with Zanata  (Read 2701 times)

0 Members and 1 Guest are viewing this topic.

Offline jwt

  • Administrator
  • Sr. Member
  • *****
  • Posts: 344
  • Karma: +101/-31
    • View Profile

Offline doktornotor

  • Hero Member
  • *****
  • Posts: 8553
  • Karma: +958/-278
  • Not a pfSense employee, they cannot fire me...
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #1 on: January 30, 2017, 07:38:30 am »
1/ Is it somehow possible to import translated .pot file in there? (After spending a couple of days translating ~15K strings for UBNT on a similar platform, I'd rather not repeat that experience.)

2/ Is is somehow possible to export the pfSense.mo for immediate use on pfSense from there, so that people can check how badly they've screwed the context?
Do NOT PM for help!

Offline Steve_B

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 390
  • Karma: +110/-0
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #2 on: January 30, 2017, 04:15:03 pm »
Yes and yes. Existing .po files can be uploaded and used as the basis for further translations. In fact the pt_BR, ja and tr files from the pfSense® source tree have already been uploaded. The .mo files may be downloaded as well as the .po files

We plan to establish some threshold (50%, 75% ??) at which the translation becomes useful enough to be automatically incorporated into the build.
« Last Edit: January 31, 2017, 08:39:43 am by Steve_B »

Offline Steve_B

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 390
  • Karma: +110/-0
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #3 on: January 30, 2017, 04:22:57 pm »
Signing up to help with a translation

If you would like to contribute your language skills to the pfSense® project, please:


This will allow us to add you to the project as quickly as possible

Thanks.
« Last Edit: January 30, 2017, 04:29:53 pm by Steve_B »

Offline athurdent

  • Hero Member
  • *****
  • Posts: 650
  • Karma: +36/-7
  • N00b.
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #4 on: January 31, 2017, 11:14:09 pm »
I ran into quite a few translations that need to be tested for context and proper use of all those %s.
Is there quick way to copy the necessary files to my test KVM to see how bad it really looks? :)

Offline doktornotor

  • Hero Member
  • *****
  • Posts: 8553
  • Karma: +958/-278
  • Not a pfSense employee, they cannot fire me...
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #5 on: January 31, 2017, 11:23:16 pm »
Well yeah that's exactly what I meant by #2.
Do NOT PM for help!

Offline athurdent

  • Hero Member
  • *****
  • Posts: 650
  • Karma: +36/-7
  • N00b.
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #6 on: January 31, 2017, 11:45:19 pm »
Well yeah that's exactly what I meant by #2.

I know :)

The .po file can be downloaded, but I cannot find any way to download the .mo file. Then again I haven't really looked into what those files are doing and if maybe the .po is the only thing I need. Guess I will try to abuse the Brazilian language folder and see where that takes me.

Offline doktornotor

  • Hero Member
  • *****
  • Posts: 8553
  • Karma: +958/-278
  • Not a pfSense employee, they cannot fire me...
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #7 on: February 01, 2017, 02:35:17 am »
Well you need to compile it; IIRC the command was something like

Code: [Select]
msgfmt -o lang.mo lang.po
but that's not exactly useful for people since that tool of course is not available on pfSense.
Do NOT PM for help!

Offline athurdent

  • Hero Member
  • *****
  • Posts: 650
  • Karma: +36/-7
  • N00b.
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #8 on: February 01, 2017, 02:51:50 am »
This seems to do the job for me:
https://po2mo.net/

Offline phil.davis

  • Hero Member
  • *****
  • Posts: 4613
  • Karma: +550/-3
    • View Profile
    • International Nepal Fellowship
Re: pfSense® software translations with Zanata
« Reply #9 on: February 01, 2017, 02:55:55 am »
I ran into quite a few translations that need to be tested for context and proper use of all those %s.
Is there quick way to copy the necessary files to my test KVM to see how bad it really looks? :)
gettext() strings for translation that include multiple "%s" should have all the "%s" numbered:
Code: [Select]
sprintf(gettext('Interface %1$s has IP address %2$s'), "LAN", "1.2.3.4")
Then a translator can re-order the sentence if they need to in a target language where the whole sentence happens a different way around.

I made a start on that in /etc with PR https://github.com/pfsense/pfsense/pull/3460
and finished it with https://github.com/pfsense/pfsense/pull/3462

Both those have been merged and I see that Renato just regenerated the ".pot" file. So I guess there are up-to-date translations strings waiting for any keen translators.
« Last Edit: February 01, 2017, 10:00:36 am by phil.davis »
As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

Offline athurdent

  • Hero Member
  • *****
  • Posts: 650
  • Karma: +36/-7
  • N00b.
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #10 on: February 02, 2017, 02:51:55 am »
Thanks Phil!

I guess something like this in firewall_rules_edit.php cannot be translated yet because it's missing those gettext thingies?

Code: [Select]
$group->setHelp(sprintf('Specify the %s port or port range for this rule. The "To" field may be left empty if only filtering a single port.',strtolower($name)));

Offline phil.davis

  • Hero Member
  • *****
  • Posts: 4613
  • Karma: +550/-3
    • View Profile
    • International Nepal Fellowship
Re: pfSense® software translations with Zanata
« Reply #11 on: February 02, 2017, 04:36:30 am »
Thanks Phil!

I guess something like this in firewall_rules_edit.php cannot be translated yet because it's missing those gettext thingies?

Code: [Select]
$group->setHelp(sprintf('Specify the %s port or port range for this rule. The "To" field may be left empty if only filtering a single port.',strtolower($name)));
PR https://github.com/pfsense/pfsense/pull/3464 should fix it.
As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

Offline athurdent

  • Hero Member
  • *****
  • Posts: 650
  • Karma: +36/-7
  • N00b.
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #12 on: February 02, 2017, 05:15:49 am »
Great, thanks!

Offline Steve_B

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 390
  • Karma: +110/-0
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #13 on: February 02, 2017, 10:36:53 am »
The correct syntax is actually:

Code: [Select]
$group->setHelp('Specify the %s port or port range for this rule. The "To" field may be left empty if only filtering a single port.', array(strtolower($name))));
setHelp accepts a second argument which is an array of arguments to be passed to sprintf. The first argument (format string) does get gettext()

I want to see if we actually use that syntax anywhere, and if not (or few) I may update it to use a more conventional syntax.

Offline KOM

  • Hero Member
  • *****
  • Posts: 5370
  • Karma: +668/-19
    • View Profile
Re: pfSense® software translations with Zanata
« Reply #14 on: February 02, 2017, 10:42:32 am »
You'll know you've hit the bigtime when someone does a translation to Klingon.

ghItlh bIngDaq ghItlh leghlu' pa' tlhIngan Hol