[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2023-07-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Owen Leonard  changed:

   What|Removed |Added

 Blocks||34437


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34437
[Bug 34437] Internationalization: Mark string not to be translated
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2023-06-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Owen Leonard  changed:

   What|Removed |Added

 Blocks||33906


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33906
[Bug 33906] [OMNIBUS] Improve translation of title tags
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2023-02-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Owen Leonard  changed:

   What|Removed |Added

 Blocks||33077


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33077
[Bug 33077] Improve ease of translating template title tags
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2020-03-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Jonathan Druart  changed:

   What|Removed |Added

 Blocks||24797


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24797
[Bug 24797] xx-XX-messages.po line numbers are not correct
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2019-11-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Jonathan Druart  changed:

   What|Removed |Added

 Blocks||24068


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24068
[Bug 24068] Koha::Template::Plugin::I18N->tnpx should call Koha::I18->__npx
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2019-11-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #146 from Julian Maurice  ---
(In reply to Caroline Cyr La Rose from comment #145)
> Woohoo! I did my first contextualization (locally)! 
> 
> I was wondering what is the process to add a contextualization to the
> community file? Do I just submit the .tt file in a bug? It probably wouldn't
> be relevant to all languages...

Glad to hear it! :)
You should create a new bug report and submit your changes in the form of a
.patch file. See https://wiki.koha-community.org/wiki/Submitting_A_Patch for
more informations.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2019-11-05 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Caroline Cyr La Rose  changed:

   What|Removed |Added

 CC||caroline.cyr-la-rose@inlibr
   ||o.com

--- Comment #145 from Caroline Cyr La Rose  
---
Woohoo! I did my first contextualization (locally)! 

I was wondering what is the process to add a contextualization to the community
file? Do I just submit the .tt file in a bug? It probably wouldn't be relevant
to all languages...

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2019-08-04 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Jonathan Druart  changed:

   What|Removed |Added

 Blocks|15522   |


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15522
[Bug 15522] New interface for revamped circulation rules
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2019-01-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Fridolin SOMERS  changed:

   What|Removed |Added

 Blocks||22080


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22080
[Bug 22080] Easier translation of ElasticSearch mappings page
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-12-28 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Katrin Fischer  changed:

   What|Removed |Added

 Blocks||22050


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22050
[Bug 22050] Problem installing Locale::Maketext::Lexicon
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

 Blocks||21895


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21895
[Bug 21895] translations fail on upgrade to 18.11.00 (package installation)
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-16 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Martin Renvoize  changed:

   What|Removed |Added

 CC||martin.renvoize@ptfs-europe
   ||.com
 Resolution|--- |FIXED
 Status|Pushed to Master|RESOLVED

--- Comment #144 from Martin Renvoize  ---
Enhancement, will not be backported to 18.05.x series.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-14 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Victor Grousset/tuxayo  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=21823

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Tomás Cohen Arazi  changed:

   What|Removed |Added

 Blocks||21823


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21823
[Bug 21823] Cannot update or create translations
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #143 from Katrin Fischer  ---
For the next one getting stuck:

sudo apt-get install libintl-perl

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #142 from Nick Clemens  ---
Awesome work all!

Pushed to master for 18.11

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Nick Clemens  changed:

   What|Removed |Added

 Status|Passed QA   |Pushed to Master

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #81741|0   |1
is obsolete||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

 Blocks||21789


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21789
[Bug 21789] Example usage of I18N Template::Toolkit plugin
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #141 from Julian Maurice  ---
(In reply to Nick Clemens from comment #140)
> This updates dependencies - will we be able to get these packaged and ready
> for release?

The added dependencies are already packaged since Debian oldoldstable. I think
they won't be a problem.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-11-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Nick Clemens  changed:

   What|Removed |Added

   Keywords||dependency
 CC||n...@bywatersolutions.com

--- Comment #140 from Nick Clemens  ---
This updates dependencies - will we be able to get these packaged and ready for
release?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #138 from Jonathan Druart  
---
Created attachment 81742
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81742=edit
Bug 15395: Use POSIX::setlocale

To keep compatibility with jessie (that have Message::Locales 1.23, so
without setlocale)

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #139 from Jonathan Druart  
---
Created attachment 81743
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81743=edit
Bug 15395: Fix QA failure - filter not found

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #137 from Jonathan Druart  
---
Created attachment 81741
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81741=edit
Bug 15395: Example usage of I18N Template::Toolkit plugin

Signed-off-by: Marc Véron 

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #136 from Jonathan Druart  
---
Created attachment 81739
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81739=edit
Bug 15395: Do not process template files that do not use i18n.inc

It should make the string extraction process a little faster

For the record, I timed some parts of the process to see why it was so
slow, and without surprises the most time-consuming task is the Perl
code analysis by PPI with an average time of 50ms by "template block" on
my machine.
Multiply that by the number of template blocks (approximatively 900),
that gives us 45 seconds just for this task.

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #132 from Jonathan Druart  
---
Created attachment 81735
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81735=edit
Bug 15395: Make msgmerge quiet

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #135 from Jonathan Druart  
---
Created attachment 81738
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81738=edit
Bug 15395: Make QA test script happy

It is not totally happy because of the template file used in tests.
It has line breaks inside TT directives and QA test script complains
because line breaks in TT directives confuse the current translatable
strings extractor.
However this patchset (along with bug 20988) will hopefully make the
current extractor obsolete and thus make the 'no-line-breaks' rule
useless

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #133 from Jonathan Druart  
---
Created attachment 81736
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81736=edit
Bug 15395: Do not use nl_putenv, use $ENV instead

nl_putenv is only useful on Windows systems

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #134 from Jonathan Druart  
---
Created attachment 81737
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81737=edit
Bug 15395: Add unit tests for extract_messages_from_templates

Because LangInstaller use FindBin to define some paths, the test
produces warnings about a missing directory. I'm not sure how we can
avoid that.

Test plan:
  1. prove t/LangInstaller.t

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Jonathan Druart  changed:

   What|Removed |Added

  Attachment #81152|0   |1
is obsolete||
  Attachment #81153|0   |1
is obsolete||
  Attachment #81154|0   |1
is obsolete||
  Attachment #81155|0   |1
is obsolete||
  Attachment #81156|0   |1
is obsolete||
  Attachment #81157|0   |1
is obsolete||
  Attachment #81158|0   |1
is obsolete||
  Attachment #81159|0   |1
is obsolete||

--- Comment #131 from Jonathan Druart  
---
Created attachment 81734
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81734=edit
Bug 15395: Allow correct handling of plural translation

Locale::Maketext does not allow correct handling of plural translation
for languages that have more than one plural forms.
Locale::Messages does.

So Koha::I18N is now a wrapper around Locale::Messages, just like
Locale::TextDomain, and export the same symbols as Locale::TextDomain.
You can refer to documentation of Locale::TextDomain to know how to use
exported subroutines.

Example usage:
  __("Hi")
  __x("Hi {name}", name => 'Bob')
  __n("item", "items", $num_items)
  __nx("one item", "{count} items", $num_items, count => $num_items)
  __p("Bibliographic record", "item")

This patch also brings Koha::I18N power to Template::Toolkit templates
by adding a TT plugin.
This plugin can be used like this:

[%# USE the plugin and define some macros %]
[% PROCESS 'i18n.inc' %]

[%# tn is the equivalent of __n %]
[%# macro names can't start with underscore, t is for "translate" %]
[% tn('item', 'items', num_items) %]
Extraction of strings from templates is a bit complicated and use
Template::Parser and PPI. Template is compiled into Perl code and then
analyzed by PPI. It is slow, but should be correct even with complex
constructions.

Remove dependency to Locale::Maketext and Locale::Maketext::Lexicon
Add dependency to Locale::Messages and PPI

Test plan for translation in Perl code:
1. Open a .pl script or .pm module with your favorite text editor
2. Add 'use Koha::I18N;' in the beginning of file
3. Use one of the subroutines exported by Koha::I18N and be sure to have
   a way to visualize the result (pass result to the template for
   example, or simply warn and watch the log file)
4. cd misc/translator && ./translate update fr-FR # try other languages
5. Open misc/translator/po/fr-FR-messages.po and translate your
   string(s)
   You may need to change the "Plural-Forms" header. See
   https://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is correct
8. prove t/Koha/I18N.t

Test plan for translation in templates:
1. Open a template file (.tt or .inc) with your favorite text editor
2. Add the PROCESS directive mentioned above in the beginning of file
3. Use one of the t* macros defined in i18n.inc. They are used like
   their "__" equivalent, with one difference: the 'x' variants take a
   hashref instead of a hash as last parameter
4. cd misc/translator && ./translate update fr-FR
5. Open misc/translator/po/fr-FR-messages.po and translate your
   string(s)
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is
   correct

Signed-off-by: Marc Véron 

Signed-off-by: Jonathan Druart 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Jonathan Druart  changed:

   What|Removed |Added

 Status|Signed Off  |Passed QA

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #130 from Jonathan Druart  
---
I am in favor of these patches as they will help us to handle plurals much
better than we do so far.

I have been working (test/review) on these patch for a long time and I think we
should include them into 18.11 to make translation improvements backportable.

The long term goal (bug 20988) can be discussed later.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #129 from Victor Grousset/tuxayo  ---
> I don't love the sound of these patches... (or the implementation of 
> Koha::I18N). 

What do you mean?


> What's performance like for handling all the translations at run time? (Might 
> not be a huge issue with template caching?)

See this section and if you can, try on your machine so we have more data about
performance impact.
https://wiki.koha-community.org/wiki/Internationalization,_plural_forms,_context,_and_more_RFC#Downsides

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

David Cook  changed:

   What|Removed |Added

 CC||dc...@prosentient.com.au

--- Comment #128 from David Cook  ---
I don't love the sound of these patches... (or the implementation of
Koha::I18N). 

What's performance like for handling all the translations at run time? (Might
not be a huge issue with template caching?)

That said, the current system for generating translations is also painful. I
have often wished that we could do something like Messages.Properties in Java
or resources in Android Java development, which seem a more flexible for
developers and easier for translators. Although I guess those might suffer from
pluralization problems too.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-29 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #127 from Katrin Fischer  ---
(In reply to Julian Maurice from comment #124)
> I wrote
> https://wiki.koha-community.org/wiki/Internationalization,_plural_forms,
> _context,_and_more_(RFC)
> 
> and initiated a thread on Framavox to gather opinions:
> https://framavox.org/d/2juWqIMz/internationalization-plural-forms-context-
> and-more
> (feel free to not use it but please give your opinion either on the wiki
> page or directly here on the bug report)

Can you please send out to the maliing list too? More devs to see it then.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-29 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #126 from Julian Maurice  ---
(In reply to Katrin Fischer from comment #123)
> Hm, looking at the example, it seems quite complicated and not sure I
> understand it. Do we really want to do that to all our strings? 
It really isn't that complicated once you get used to it, and all other
softwares I have worked on do that in one way or another. So yes, I think we
should to that to all our strings. But please note that the example is
demonstrating how plural forms will work, and the majority of strings will be
in the simpler form: [% t('translatable strings') %]

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-29 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #125 from Julian Maurice  ---
Moved the wiki page to
https://wiki.koha-community.org/wiki/Internationalization,_plural_forms,_context,_and_more_RFC
(parentheses break URL)

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-29 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #124 from Julian Maurice  ---
I wrote
https://wiki.koha-community.org/wiki/Internationalization,_plural_forms,_context,_and_more_(RFC)

and initiated a thread on Framavox to gather opinions:
https://framavox.org/d/2juWqIMz/internationalization-plural-forms-context-and-more
(feel free to not use it but please give your opinion either on the wiki page
or directly here on the bug report)

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-28 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Serhij Dubyk  changed:

   What|Removed |Added

 CC||du...@ukr.net

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Katrin Fischer  changed:

   What|Removed |Added

 CC||oleon...@myacpl.org

--- Comment #123 from Katrin Fischer  ---
Hm, looking at the example, it seems quite complicated and not sure I
understand it. Do we really want to do that to all our strings? 

I feel like we should discuss this change at a general meeting if the long term
goal is to change the way we write templates fundamentally outside of some
cases where the extra features are useful.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #122 from Katrin Fischer  ---
Hi Julian,

it's Saturday! ;)

I think some best practice examples like this one from the comments would be
good:

[% IF count %]
  [% tnx('{count} item', '{count} items', count, { count = count }) %]
[% ELSE %]
  [% t('Not a single item!') %]
[% END %]

Also still not sure about the "context and more" - seeing examples for that if
possible would be great too.

An example in German for where context would be useful is "subject". It can be
an email subject, a topic subject on a bibliographic record or just the subject
(topic) something talks about... and it would all be different words in German.

And maybe some explanation about how this changes the translation process
technically?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #121 from Julian Maurice  ---
(In reply to Katrin Fischer from comment #120)
> Hi all, 
> 
> really happy to see this one moving! 
Really happy too!

> 
> Maybe time to think about a few things:
> 
> - When is the best moment to push this to master? Should we aim to before
> string freeze? In this case it would be nice to get an OK from Bernardo
> before we do that. The scheduled time for translating is not very long this
> time, so we should avoid issues. I think plural forms might not be set in
> all our files. Some languages like Japanese don't even have proper plural.
Apart from the "Example usage of I18N Template::Toolkit plugin" patch, this
whole patchset won't affect existing translations at all. I'm thinking that
maybe I can provide an other example in a more hidden place, so if there is
problem with it at release it won't be noticed (or maybe just don't push the
example, to be totally safe)

> 
> - Does it affect performance? I see you discussed times for generating the
> .po/.mo files already. What about page loads? I am not sure if I understood
> the method correctly here, are we still creating translated templates or is
> this more 'on the fly'?
We'll have to continue to create translated templates until all translatable
messages are "wrapped" (see bug 20988 which aims to do that) and translated.
But once it is done we should stop, as all translations would be retrieved on
the fly. So it will affect performance, but it should be negligible. I did some
performance tests some time ago and noticed an increase in page load time of
~3ms for 100 strings translated in a template file. I'm currently trying to
write another performance test script. I'll publish it as soon as it is
finished so other people can test.

> 
> - Can we have some dev documentation for the wiki with explanations and
> examples?
I can certainly do that. What kind of explanations would you expect from such
documentation ?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-27 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Katrin Fischer  changed:

   What|Removed |Added

 CC||katrin.fisc...@bsz-bw.de

--- Comment #120 from Katrin Fischer  ---
Hi all, 

really happy to see this one moving! 

Maybe time to think about a few things:

- When is the best moment to push this to master? Should we aim to before
string freeze? In this case it would be nice to get an OK from Bernardo before
we do that. The scheduled time for translating is not very long this time, so
we should avoid issues. I think plural forms might not be set in all our files.
Some languages like Japanese don't even have proper plural.

- Does it affect performance? I see you discussed times for generating the
.po/.mo files already. What about page loads? I am not sure if I understood the
method correctly here, are we still creating translated templates or is this
more 'on the fly'?

- Can we have some dev documentation for the wiki with explanations and
examples?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #119 from Julian Maurice  ---
Created attachment 81167
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81167=edit
Screenshot of Pootle with plural translations and context

(In reply to Julian Maurice from comment #100)
> (In reply to Jonathan Druart from comment #99)
> > Did you try if these changes will behave correctly in pootle?
> > i.e. Does the pootle's interface will let translators filled these forms
> > according to the language, etc.?
> I haven't tried but the documentation says that pootle support this feature
> http://docs.translatehouse.org/projects/translate-toolkit/en/latest/formats/
> po.html#po
> and it's a basic feature of gettext/PO files. I would be very surprised if
> Pootle doesn't handle it.

And it handle it very well. See screenshot attached

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #118 from Julian Maurice  ---
(In reply to Julian Maurice from comment #105)
> (In reply to Jonathan Druart from comment #102)
> > Code review:
> > 1. Not important but the Koha.po file provided for the tests are not taken
> > into account. Maybe it could be better to generate the .mo from the tests?
> Or maybe we can simply remove the .po file as it can be easily generated from
> the .mo file with msgunfmt ?
I removed it from the first patch and added a comment in the test script to
tell
how to modify this MO file

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #117 from Julian Maurice  ---
(In reply to Jonathan Druart from comment #104)
> (In reply to Julian Maurice from comment #92)
> > Extraction of strings from templates is a bit complicated and use
> > Template::Parser and PPI. Template is compiled into Perl code and then
> > analyzed by PPI. It is slow, but should be correct even with complex
> > constructions.
> 
> Indeed, it is super slow compared. I would consider it acceptable compared
> to the enhancement it brings.
> 

attachment 81158 should make it a little more acceptable

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #116 from Julian Maurice  ---
(In reply to Jonathan Druart from comment #107)
> (In reply to Julian Maurice from comment #105)
> > > 3. The content from the .inc files are added to the .po because they 
> > > contain
> > > TT blocks on several lines. Maybe we should have a list of files to skip 
> > > and
> > > copy as it (?)
> > I don't understand. My .po file is clean after an 'update'. Why would we
> > want to skip .inc files ? Can you give an example of what gets wrongly added
> > to the .po ?
> 
> #: opac-tmpl/bootstrap/en/includes/i18n.inc:1
> #, c-format
> msgid ""
> "[%% USE I18N; MACRO t(msgid) BLOCK; I18N.t(msgid); END; MACRO tx(msgid, "
> "vars) BLOCK; I18N.tx(msgid, vars); END; MACRO tn(msgid, msgid_plural,
> count) "
> "BLOCK; I18N.tn(msgid, msgid_plural, count); END; MACRO tnx(msgid, "
> "msgid_plural, count, vars) BLOCK; I18N.tnx(msgid, msgid_plural, count, "
> "vars); END; MACRO txn(msgid, msgid_plural, count, vars) BLOCK; I18N."
> "txn(msgid, msgid_plural, count, vars); END; MACRO tp(msgctxt, msgid) BLOCK;
> "
> "I18N.tp(msgctxt, msgid); END; MACRO tpx(msgctxt, msgid, vars) BLOCK; I18N."
> "tpx(msgctxt, msgid, vars); END; MACRO tnp(msgctxt, msgid, msgid_plural, "
> "count) BLOCK; I18N.tnp(msgctxt, msgid, msgid_plural, count); END; MACRO "
> "tnpx(msgctxt, msgid, msgid_plural, count, vars) BLOCK; I18N.tnpx(msgctxt, "
> "msgid, msgid_plural, count, vars); END; %%] "
> msgstr ""
> 
> And there is nothing to translate in this file, there are just TT tags.
> It happens when TT tags are split on several lines.

Ah I thought you were talking about xx-XX-messages.po but this is in
xx-XX-opac-bootstrap.po right ?

This should be fixed by attachment 81157

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #77476|0   |1
is obsolete||

--- Comment #115 from Julian Maurice  ---
Created attachment 81159
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81159=edit
Bug 15395: Example usage of I18N Template::Toolkit plugin

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #114 from Julian Maurice  ---
Created attachment 81158
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81158=edit
Bug 15395: Do not process template files that do not use i18n.inc

It should make the string extraction process a little faster

For the record, I timed some parts of the process to see why it was so
slow, and without surprises the most time-consuming task is the Perl
code analysis by PPI with an average time of 50ms by "template block" on
my machine.
Multiply that by the number of template blocks (approximatively 900),
that gives us 45 seconds just for this task.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #113 from Julian Maurice  ---
Created attachment 81157
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81157=edit
Bug 15395: Make QA test script happy

It is not totally happy because of the template file used in tests.
It has line breaks inside TT directives and QA test script complains
because line breaks in TT directives confuse the current translatable
strings extractor.
However this patchset (along with bug 20988) will hopefully make the
current extractor obsolete and thus make the 'no-line-breaks' rule
useless

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #111 from Julian Maurice  ---
Created attachment 81155
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81155=edit
Bug 15395: Do not use nl_putenv, use $ENV instead

nl_putenv is only useful on Windows systems

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #112 from Julian Maurice  ---
Created attachment 81156
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81156=edit
Bug 15395: Add unit tests for extract_messages_from_templates

Because LangInstaller use FindBin to define some paths, the test
produces warnings about a missing directory. I'm not sure how we can
avoid that.

Test plan:
  1. prove t/LangInstaller.t

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #109 from Julian Maurice  ---
Created attachment 81153
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81153=edit
Bug 15395: Require Locale::Messages 1.24

1.21 fixes a bug in the way environment variables LANGUAGE and LANG are
interpreted
https://rt.cpan.org/Public/Bug/Display.html?id=81315

1.24 brings its own setlocale which "does the right thing"
https://metacpan.org/pod/release/GUIDO/libintl-perl-1.29/lib/Locale/Messages.pm#setlocale

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #110 from Julian Maurice  ---
Created attachment 81154
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81154=edit
Bug 15395: Make msgmerge quiet

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #77475|0   |1
is obsolete||

--- Comment #108 from Julian Maurice  ---
Created attachment 81152
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=81152=edit
Bug 15395: Allow correct handling of plural translation

Locale::Maketext does not allow correct handling of plural translation
for languages that have more than one plural forms.
Locale::Messages does.

So Koha::I18N is now a wrapper around Locale::Messages, just like
Locale::TextDomain, and export the same symbols as Locale::TextDomain.
You can refer to documentation of Locale::TextDomain to know how to use
exported subroutines.

Example usage:
  __("Hi")
  __x("Hi {name}", name => 'Bob')
  __n("item", "items", $num_items)
  __nx("one item", "{count} items", $num_items, count => $num_items)
  __p("Bibliographic record", "item")

This patch also brings Koha::I18N power to Template::Toolkit templates
by adding a TT plugin.
This plugin can be used like this:

[%# USE the plugin and define some macros %]
[% PROCESS 'i18n.inc' %]

[%# tn is the equivalent of __n %]
[%# macro names can't start with underscore, t is for "translate" %]
[% tn('item', 'items', num_items) %]
Extraction of strings from templates is a bit complicated and use
Template::Parser and PPI. Template is compiled into Perl code and then
analyzed by PPI. It is slow, but should be correct even with complex
constructions.

Remove dependency to Locale::Maketext and Locale::Maketext::Lexicon
Add dependency to Locale::Messages and PPI

Test plan for translation in Perl code:
1. Open a .pl script or .pm module with your favorite text editor
2. Add 'use Koha::I18N;' in the beginning of file
3. Use one of the subroutines exported by Koha::I18N and be sure to have
   a way to visualize the result (pass result to the template for
   example, or simply warn and watch the log file)
4. cd misc/translator && ./translate update fr-FR # try other languages
5. Open misc/translator/po/fr-FR-messages.po and translate your
   string(s)
   You may need to change the "Plural-Forms" header. See
   https://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is correct
8. prove t/Koha/I18N.t

Test plan for translation in templates:
1. Open a template file (.tt or .inc) with your favorite text editor
2. Add the PROCESS directive mentioned above in the beginning of file
3. Use one of the t* macros defined in i18n.inc. They are used like
   their "__" equivalent, with one difference: the 'x' variants take a
   hashref instead of a hash as last parameter
4. cd misc/translator && ./translate update fr-FR
5. Open misc/translator/po/fr-FR-messages.po and translate your
   string(s)
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is
   correct

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #107 from Jonathan Druart  
---
(In reply to Julian Maurice from comment #105)
> > 3. The content from the .inc files are added to the .po because they contain
> > TT blocks on several lines. Maybe we should have a list of files to skip and
> > copy as it (?)
> I don't understand. My .po file is clean after an 'update'. Why would we
> want to skip .inc files ? Can you give an example of what gets wrongly added
> to the .po ?

#: opac-tmpl/bootstrap/en/includes/i18n.inc:1
#, c-format
msgid ""
"[%% USE I18N; MACRO t(msgid) BLOCK; I18N.t(msgid); END; MACRO tx(msgid, "
"vars) BLOCK; I18N.tx(msgid, vars); END; MACRO tn(msgid, msgid_plural, count) "
"BLOCK; I18N.tn(msgid, msgid_plural, count); END; MACRO tnx(msgid, "
"msgid_plural, count, vars) BLOCK; I18N.tnx(msgid, msgid_plural, count, "
"vars); END; MACRO txn(msgid, msgid_plural, count, vars) BLOCK; I18N."
"txn(msgid, msgid_plural, count, vars); END; MACRO tp(msgctxt, msgid) BLOCK; "
"I18N.tp(msgctxt, msgid); END; MACRO tpx(msgctxt, msgid, vars) BLOCK; I18N."
"tpx(msgctxt, msgid, vars); END; MACRO tnp(msgctxt, msgid, msgid_plural, "
"count) BLOCK; I18N.tnp(msgctxt, msgid, msgid_plural, count); END; MACRO "
"tnpx(msgctxt, msgid, msgid_plural, count, vars) BLOCK; I18N.tnpx(msgctxt, "
"msgid, msgid_plural, count, vars); END; %%] "
msgstr ""

And there is nothing to translate in this file, there are just TT tags.
It happens when TT tags are split on several lines.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #106 from Julian Maurice  ---
(In reply to Jonathan Druart from comment #104)
> BTW do you know what is the ". done." outputted by install?

It is a message outputted by msgmerge, I will make it quiet

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #105 from Julian Maurice  ---
(In reply to Jonathan Druart from comment #102)
> Code review:
> 1. Not important but the Koha.po file provided for the tests are not taken
> into account. Maybe it could be better to generate the .mo from the tests?
Or maybe we can simply remove the .po file as it can be easily generated from
the .mo file with msgunfmt ?

> 2. No tests provided for misc/translator/LangInstaller.pm - I would not
> consider it as blocker as it is the current state.
Thanks for not considering it a blocker :)
Testing a module that modifies the filesystem can be a huge pain, especially in
this case where paths are hardcoded and where it modifies files tracked by git.
But I can certainly try to write a test for extract_messages_from_templates
since it doesn't have too many external dependencies and is the most
complicated thing of the whole patch.

> 3. The content from the .inc files are added to the .po because they contain
> TT blocks on several lines. Maybe we should have a list of files to skip and
> copy as it (?)
I don't understand. My .po file is clean after an 'update'. Why would we want
to skip .inc files ? Can you give an example of what gets wrongly added to the
.po ?

> 4. What is done in Koha::I18N::init is weird, but I trust you if you think
> everythink is needed.
I agree that it's weird but I'm pretty sure everything is needed

> However: pod Locale::Messages, nl_putenv: "The sole purpose of this function
> is to work around some ideosyncrasies in the environment processing of
> Windows systems. If you want to portably set or unset environment variables,
> use this function instead of directly manipulating %ENV."
> So maybe we should use ENV, it will make the line clear about what it does,
> and 'git grep $ENV' will work
Ok I'll try without nl_putenv and see if it works

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-24 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #104 from Jonathan Druart  
---
(In reply to Julian Maurice from comment #92)
> Extraction of strings from templates is a bit complicated and use
> Template::Parser and PPI. Template is compiled into Perl code and then
> analyzed by PPI. It is slow, but should be correct even with complex
> constructions.

Indeed, it is super slow compared. I would consider it acceptable compared to
the enhancement it brings.

(master) % time perl translate update fr-FR
perl translate update fr-FR  10.02s user 5.16s system 84% cpu 17.868 total
(master) % time perl translate install fr-FR
perl translate install fr-FR  12.88s user 3.05s system 79% cpu 19.988 total

(bug_21156) % time perl translate install fr-FR
. done.
perl translate update fr-FR  102.00s user 11.62s system 97% cpu 1:56.00 total
(bug_21156) % time perl translate install fr-FR
perl translate install fr-FR  12.49s user 2.56s system 79% cpu 18.940 total

BTW do you know what is the ". done." outputted by install?

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #103 from Julian Maurice  ---
(In reply to Jonathan Druart from comment #101)
> So, from what I understand the third form (for 0) will be not supported,
> unless we change the Plural-Forms (are we really supposed to change that?).
I don't think we are supposed to.
The simple solution would be to always use the {count} so we would have "0
exemplaire" and "1 exemplaire".
Or we could handle this in the code:

[% IF count %]
  [% tnx('{count} item', '{count} items', count, { count = count }) %]
[% ELSE %]
  [% t('Not a single item!') %]
[% END %]

I think there is no best solution here and both can be used.
Sometimes we want to display a different message when there are 0 "things", and
sometimes not.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #102 from Jonathan Druart  
---
Code review:
1. Not important but the Koha.po file provided for the tests are not taken into
account. Maybe it could be better to generate the .mo from the tests?
2. No tests provided for misc/translator/LangInstaller.pm - I would not
consider it as blocker as it is the current state.
3. The content from the .inc files are added to the .po because they contain TT
blocks on several lines. Maybe we should have a list of files to skip and copy
as it (?)
4. What is done in Koha::I18N::init is weird, but I trust you if you think
everythink is needed.
However: pod Locale::Messages, nl_putenv: "The sole purpose of this function is
to work around some ideosyncrasies in the environment processing of Windows
systems. If you want to portably set or unset environment variables, use this
function instead of directly manipulating %ENV."
So maybe we should use ENV, it will make the line clear about what it does, and
'git grep $ENV' will work

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #101 from Jonathan Druart  
---
It works better instead.

Just noting:

== es-ES - nplurals=2; plural=(n != 1); ==
msgid "{count} item"
msgid_plural "{count} items"
msgstr[0] "Uno ejemplar"
msgstr[1] "{count} ejemplares"

will output:
  1: Uno ejemplar
  2: 2 ejemplares
but also:
  0: 0 ejemplares

== fr-FR - nplurals=2; plural=(n > 1); ==
msgid "{count} item"
msgid_plural "{count} items"
msgstr[0] "Un exemplaire"
msgstr[1] "{count} exemplaires"

will output:
  1: Un examplaire
  2: 2 exemplaires
but also:
  0: Un exemplaire

So, from what I understand the third form (for 0) will be not supported, unless
we change the Plural-Forms (are we really supposed to change that?).

With:
"Plural-Forms: nplurals=3; plural=(n==0 ? 0 : n==1 ? 1 : 2);\n"

#: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt:1
#: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt:2
#, perl-brace-format
msgid "{count} item"
msgid_plural "{count} items"
msgstr[0] "Pas d'exemplaire"
msgstr[1] "Un exemplaire"
msgstr[2] "{count} exemplaires"

I get what I expected:
  1: Un exemplaire
  2: 2 exemplaires
  0: Pas d'exemplaire

(I have moved the tnx call outside before the SEARCH_RESULT.items_count)

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #100 from Julian Maurice  ---
(In reply to Jonathan Druart from comment #99)
> > - According to
> > https://localization-guide.readthedocs.io/en/latest/l10n/pluralforms.html
> > Spanish has 2 "plural forms" (one of which is the singular form), so
> > msgstr[0] should contain the singular form and msgstr[1] the plural form.
> 
> Did you try if these changes will behave correctly in pootle?
> i.e. Does the pootle's interface will let translators filled these forms
> according to the language, etc.?
I haven't tried but the documentation says that pootle support this feature
http://docs.translatehouse.org/projects/translate-toolkit/en/latest/formats/po.html#po
and it's a basic feature of gettext/PO files. I would be very surprised if
Pootle doesn't handle it.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #99 from Jonathan Druart  
---
(In reply to Julian Maurice from comment #98)
> Hi Jonathan, and thanks for testing.
> 
> There are several problems here:
> - You must not modify msgid_plural in the PO file, it's a string identifier
> just like msgid.

Erk! ok retesting!

> - According to
> https://localization-guide.readthedocs.io/en/latest/l10n/pluralforms.html
> Spanish has 2 "plural forms" (one of which is the singular form), so
> msgstr[0] should contain the singular form and msgstr[1] the plural form.

Did you try if these changes will behave correctly in pootle?
i.e. Does the pootle's interface will let translators filled these forms
according to the language, etc.?

> - Locale::Messages does export setlocale but only since version 1.24. It
> should be ok since Ubuntu xenial/16.04 and Debian stretch/stable. Which
> version of this package are you using ?

1.23
I guess it will not hurt to have it, right?

> - bug 21156 is not needed here. Please don't apply it.

ok!

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #98 from Julian Maurice  ---
Hi Jonathan, and thanks for testing.

There are several problems here:
- You must not modify msgid_plural in the PO file, it's a string identifier
just like msgid.
- According to
https://localization-guide.readthedocs.io/en/latest/l10n/pluralforms.html
Spanish has 2 "plural forms" (one of which is the singular form), so msgstr[0]
should contain the singular form and msgstr[1] the plural form.
- Locale::Messages does export setlocale but only since version 1.24. It should
be ok since Ubuntu xenial/16.04 and Debian stretch/stable. Which version of
this package are you using ?
- bug 21156 is not needed here. Please don't apply it.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #97 from Jonathan Druart  
---
Also I should note that I had to amend the code, the tests were failing

 #   Failed test 'use Koha::I18N;'
 #   at t/Koha/I18N.t line 10.
 # Tried to use 'Koha::I18N'.
 # Error:  "setlocale" is not exported by the Locale::Messages module

I did, in Koha/I18N.pm
-use Locale::Messages qw(:locale_h nl_putenv setlocale LC_MESSAGES);
+use Locale::Messages qw(:locale_h nl_putenv LC_MESSAGES);
+use POSIX qw (setlocale);

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-10-23 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #96 from Jonathan Druart  
---
Sorry but I still do not manage to make it works.

Naive test, following the test plan:
0/ do not apply the patch
1/ perl translate update es-ES && perl translate install es-ES
2/ git commit -a -m"init po's" # to see the diff later
3/ yes|git bz apply 21156
4/ perl translate update es-ES
5/ Edit misc/translator/po/es-ES-messages.po
6/

#: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt:1
#, perl-brace-format
msgid "{count} item"
msgid_plural "XXX {count} ejemplares XXX"
msgstr[0] "No ejemplar"
msgstr[1] "Solo uno ejemplar"

4/ perl translate install es-ES

5/ I see:
English version: https://snag.gy/91kXtN.jpg
Spanish version: https://snag.gy/HD7OQN.jpg

I have added
  msgstr[2] "XXX {count} ejemplares XXX"
But it does not change the result.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-08-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #95 from Julian Maurice  ---
JS part is in bug 21156

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-08-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

 Blocks||21156


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21156
[Bug 21156] Internationalization: plural forms, context, and more for JS files
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-08-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #94 from Julian Maurice  ---
To ease testing I squashed all the patches, merged the test plans, and removed
the JS part (I will re-add it in another bug).

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-08-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #73901|0   |1
is obsolete||
  Attachment #73902|0   |1
is obsolete||
  Attachment #73903|0   |1
is obsolete||
  Attachment #73904|0   |1
is obsolete||
  Attachment #73905|0   |1
is obsolete||
  Attachment #73906|0   |1
is obsolete||
  Attachment #73907|0   |1
is obsolete||
  Attachment #73908|0   |1
is obsolete||
  Attachment #73909|0   |1
is obsolete||
  Attachment #73910|0   |1
is obsolete||
  Attachment #73911|0   |1
is obsolete||
  Attachment #73912|0   |1
is obsolete||
  Attachment #73913|0   |1
is obsolete||
  Attachment #76328|0   |1
is obsolete||
  Attachment #76329|0   |1
is obsolete||
  Attachment #76330|0   |1
is obsolete||

--- Comment #92 from Julian Maurice  ---
Created attachment 77475
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=77475=edit
Bug 15395: Allow correct handling of plural translation

Locale::Maketext does not allow correct handling of plural translation
for languages that have more than one plural forms.
Locale::Messages does.

So Koha::I18N is now a wrapper around Locale::Messages, just like
Locale::TextDomain, and export the same symbols as Locale::TextDomain.
You can refer to documentation of Locale::TextDomain to know how to use
exported subroutines.

Example usage:
  __("Hi")
  __x("Hi {name}", name => 'Bob')
  __n("item", "items", $num_items)
  __nx("one item", "{count} items", $num_items, count => $num_items)
  __p("Bibliographic record", "item")

This patch also brings Koha::I18N power to Template::Toolkit templates
by adding a TT plugin.
This plugin can be used like this:

[%# USE the plugin and define some macros %]
[% PROCESS 'i18n.inc' %]

[%# tn is the equivalent of __n %]
[%# macro names can't start with underscore, t is for "translate" %]
[% tn('item', 'items', num_items) %]
Extraction of strings from templates is a bit complicated and use
Template::Parser and PPI. Template is compiled into Perl code and then
analyzed by PPI. It is slow, but should be correct even with complex
constructions.

Remove dependency to Locale::Maketext and Locale::Maketext::Lexicon
Add dependency to Locale::Messages and PPI

Test plan for translation in Perl code:
1. Open a .pl script or .pm module with your favorite text editor
2. Add 'use Koha::I18N;' in the beginning of file
3. Use one of the subroutines exported by Koha::I18N and be sure to have
   a way to visualize the result (pass result to the template for
   example, or simply warn and watch the log file)
4. cd misc/translator && ./translate update fr-FR # try other languages
5. Open misc/translator/po/fr-FR-messages.po and translate your
   string(s)
   You may need to change the "Plural-Forms" header. See
   https://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is correct
8. prove t/Koha/I18N.t

Test plan for translation in templates:
1. Open a template file (.tt or .inc) with your favorite text editor
2. Add the PROCESS directive mentioned above in the beginning of file
3. Use one of the t* macros defined in i18n.inc. They are used like
   their "__" equivalent, with one difference: the 'x' variants take a
   hashref instead of a hash as last parameter
4. cd misc/translator && ./translate update fr-FR
5. Open misc/translator/po/fr-FR-messages.po and translate your
   string(s)
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is
   correct

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-08-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #93 from Julian Maurice  ---
Created attachment 77476
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=77476=edit
Bug 15395: Example usage of I18N Template::Toolkit plugin

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-06-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

 Blocks||20988


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20988
[Bug 20988] Internationalization: wrap all translatable text inside t() calls
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-06-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #91 from Julian Maurice  ---
Created attachment 76330
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76330=edit
Bug 15395: Fix translation when text contains non-ASCII characters

msgid, msgid_plural and msgctxt need to be utf8-encoded

Also, remove call to Locale::Messages->select_package which is not
needed anymore

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-06-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #89 from Julian Maurice  ---
Created attachment 76328
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76328=edit
Bug 15395: Keep JS translations separated from others

It saves the browser from downloading a whole ~1Mib JSON file where 99%
of it will only be used on the server side.
The downside of this is that if the same strings appear in templates and
in JS files, they will have to be translated twice.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-06-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #90 from Julian Maurice  ---
Created attachment 76329
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76329=edit
Bug 15395: Extract strings from TT BLOCKs too

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71952|0   |1
is obsolete||

--- Comment #87 from Julian Maurice  ---
Created attachment 73913
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73913=edit
Bug 15395: Fix for libintl-perl >= 1.25

Since 1.25, LANGUAGE environment variable is ignored unless LANG is set
to a valid locale.
This patch sets LANG to a valid locale and calls setlocale. If no valid
locale can be found, a warning message is written in logs.

See https://rt.cpan.org/Public/Bug/Display.html?id=81315
and also https://github.com/gflohr/libintl-perl/commit/5910980b6e

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71951|0   |1
is obsolete||

--- Comment #86 from Julian Maurice  ---
Created attachment 73912
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73912=edit
Bug 15395: Improve TT plugin example

Include the number in the translatable string

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #88 from Julian Maurice  ---
Patches rebased on master

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71950|0   |1
is obsolete||

--- Comment #85 from Julian Maurice  ---
Created attachment 73911
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73911=edit
Bug 15395: Remove the use of Locale::Util's set_locale

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71943|0   |1
is obsolete||

--- Comment #78 from Julian Maurice  ---
Created attachment 73904
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73904=edit
Bug 15395: Exclude xslt from the list of themes when building locale_data.js

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71948|0   |1
is obsolete||

--- Comment #83 from Julian Maurice  ---
Created attachment 73909
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73909=edit
Bug 15395: Example usage of I18N Template::Toolkit plugin

Moved this patch for example usage to teh end of patch set
and resolved minor conflict while applyin
Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71945|0   |1
is obsolete||

--- Comment #80 from Julian Maurice  ---
Created attachment 73906
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73906=edit
Bug 15395: Fix output of msgcat

By default, msgcat tries to merge translations when two or more files have the
same msgid, even for the header (msgid ""). This resulted in an invalid PO file
("#-#-#-#-#" markers in header).
This patch tells msgcat to use the first available translation instead.

Also, this patch set correctly the Project-Id-Version field

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71944|0   |1
is obsolete||

--- Comment #79 from Julian Maurice  ---
Created attachment 73905
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73905=edit
Bug 15395: Fix PO header reading in po2json

Since version 0.24 Locale::PO do not escape newline characters in string
returned by dequote()
This patch set the required version of Locale::PO to 0.24 and fix po2json

https://rt.cpan.org/Public/Bug/Display.html?id=96016
Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71941|0   |1
is obsolete||

--- Comment #76 from Julian Maurice  ---
Created attachment 73902
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73902=edit
Bug 15395: Plural translations in templates

Provides a way to handle translation of plural forms in templates

Add Template::Toolkit plugin for Koha::I18N

Use like this:

[%# USE the plugin and define some macros %]
[% PROCESS 'i18n.inc' %]

[%# tn is the equivalent of __n %]
[%# macro names can't start with underscore, t is for "translate" %]
[% tn('item', 'items', num_items) %]

Extraction of strings from templates is a bit complicated and use
Template::Parser and PPI. Template is compiled into Perl code and then
analyzed by PPI. It is slow, but should be correct even with complex
constructions.

Add dependency to PPI

Test plan:
1. Open a template file (.tt or .inc) with your favorite text editor
2. Add the PROCESS directive mentioned above in the beginning of file
3. Use one of the t* macros defined in i18n.inc. They are used like
   their "__" equivalent, with one difference: the 'x' variants take a
   hashref instead of a hash as last parameter
4. cd misc/translator && ./translate update fr-FR
5. Open misc/translator/po/fr_FR/LC_MESSAGES/Koha.po and translate your
   string(s)
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is
   correct

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71942|0   |1
is obsolete||

--- Comment #77 from Julian Maurice  ---
Created attachment 73903
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73903=edit
Bug 15395: Add plural translation capabilities to JS files

It adds Javascript equivalent of Koha::I18N's exported subroutines, and
they are used the same way.

String extraction is done only on *.js files and require gettext 0.19
(available in Debian stable, and also in wheezy-backports)

It adds Javascript library Gettext.js for handling translation and a
Perl script po2json to transform PO file into JSON.

Gettext.js and po2json both come from Locale::Simple.
There are several tools named po2json. It's simpler to integrate this
one into Koha than to check if the good one is installed on the system.
Locale::Simple is not needed.

To avoid polluting the global namespace too much, this patch also
introduce a global JS object named Koha and add some stuff in Koha.i18n

Test plan:
1. Add a translatable string in a JS file. For example, add this:
 alert(__nx("There is one item", "There are {count} items", 3,
 {count: 3}));
   to staff-global.js
2. cd misc/translator && ./translate update fr-FR
3. Open misc/translator/po/fr_FR/LC_MESSAGES/Koha.po, verify that your
   string is present, and translate it
4. cd misc/translator && ./translate install fr-FR
5. (Optional) Verify that
   koha-tmpl/intranet-tmpl/prog/fr-FR/js/locale_data.js exists and
   contains your translation
6. Open your browser on the staff main page, change language and verify
   that the message is translated
7. Repeat 1-6 on OPAC side

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71949|0   |1
is obsolete||

--- Comment #84 from Julian Maurice  ---
Created attachment 73910
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73910=edit
Bug 15395: Fix several issues in translation process

- Change location of generated PO files to ease its integration into Pootle
  (po/xx-XX-messages.po instead of xx_XX/LC_MESSAGES/Koha.po)
- Use msginit for PO creation to try to set correctly Plural-Forms header. If
it
  fails, set a default one
- 'install' command now creates the PO file if it doesn't already exist
- Fix locale name when language code is different from ll-CC (where ll is the
  language code and CC is the country code).

Test plan:
1. `perl translate install ar-Arab` should results in
   po/ar/LC_MESSAGES/Koha.mo and po/ar-Arab-messages.po
2. `perl translate install gl` should results in
   po/gl/LC_MESSAGES/Koha.mo and po/gl-messages.po
3. `perl translate install zh-Hans-CN` should results in
   po/zh_CN/LC_MESSAGES/Koha.mo and po/zh-Hans-CN-messages.po
4. `perl translate install fr-FR` should results in
   po/fr_FR/LC_MESSAGES/Koha.mo and po/fr-FR-messages.po

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71946|0   |1
is obsolete||

--- Comment #81 from Julian Maurice  ---
Created attachment 73907
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73907=edit
Bug 15395: Make Koha::I18N work with Plack + add tests

Language detection was done in a BEGIN block so it was not working correctly
with Plack. This is now done when the first translation is requested.

This patch also fixes a bug when set_locale(LC_ALL, ...) fails for some reasons
(locale is not installed system-wide for example).

And finally, add some unit tests

Test plan:
1. prove t/Koha/I18N.t
2. Replay the previous test plans with plack enabled

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71947|0   |1
is obsolete||

--- Comment #82 from Julian Maurice  ---
Created attachment 73908
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73908=edit
Bug 15395: Search .js files in more directories

Specifically, koha-tmpl/intranet-tmpl/prog/js and
koha-tmpl/opac-tmpl/bootstrap/js

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #71940|0   |1
is obsolete||

--- Comment #75 from Julian Maurice  ---
Created attachment 73901
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73901=edit
Bug 15395: Allow correct handling of plural translation

Locale::Maketext does not allow correct handling of plural translation
for languages that have more than one plural forms.
Locale::Messages does.

So Koha::I18N is now a wrapper around Locale::Messages, just like
Locale::TextDomain, and export the same symbols as Locale::TextDomain.
You can refer to documentation of Locale::TextDomain to know how to use
exported subroutines.

The PO file moves from misc/translator/po/xx-XX-messages.po to
misc/translator/po/xx_XX/LC_MESSAGES/Koha.po and now needs to be
compiled to MO in order to be used by Koha.
Compilation of PO file is done by running:
  ./translate install xx-XX

Remove dependency to Locale::Maketext and Locale::Maketext::Lexicon
Add dependency to Locale::Messages

Test plan:
1. Open a .pl script or .pm module with your favorite text editor
2. Add 'use Koha::I18N;' in the beginning of file
3. Use one of the subroutines exported by Koha::I18N and be sure to have
   a way to visualize the result (pass result to the template for
   example, or simply warn and watch the log file)
4. cd misc/translator && ./translate update fr-FR # try other languages
5. Open misc/translator/po/fr_FR/LC_MESSAGES/Koha.po and translate your
   string(s)
   You will need to change the "Plural-Forms" header. See
   https://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is correct

Example usage:
  __("Hi")
  __x("Hi {name}", name => 'Bob')
  __n("item", "items", $num_items)
  __nx("one item", "{count} items", $num_items, count => $num_items)
  __p("Bibliographic record", "item")

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #73 from Julian Maurice  ---
Created attachment 71951
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71951=edit
Bug 15395: Improve TT plugin example

Include the number in the translatable string

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

--- Comment #74 from Julian Maurice  ---
Created attachment 71952
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71952=edit
Bug 15395: Fix for libintl-perl >= 1.25

Since 1.25, LANGUAGE environment variable is ignored unless LANG is set
to a valid locale.
This patch sets LANG to a valid locale and calls setlocale. If no valid
locale can be found, a warning message is written in logs.

See https://rt.cpan.org/Public/Bug/Display.html?id=81315
and also https://github.com/gflohr/libintl-perl/commit/5910980b6e

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #70975|0   |1
is obsolete||

--- Comment #71 from Julian Maurice  ---
Created attachment 71949
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71949=edit
Bug 15395: Fix several issues in translation process

- Change location of generated PO files to ease its integration into Pootle
  (po/xx-XX-messages.po instead of xx_XX/LC_MESSAGES/Koha.po)
- Use msginit for PO creation to try to set correctly Plural-Forms header. If
it
  fails, set a default one
- 'install' command now creates the PO file if it doesn't already exist
- Fix locale name when language code is different from ll-CC (where ll is the
  language code and CC is the country code).

Test plan:
1. `perl translate install ar-Arab` should results in
   po/ar/LC_MESSAGES/Koha.mo and po/ar-Arab-messages.po
2. `perl translate install gl` should results in
   po/gl/LC_MESSAGES/Koha.mo and po/gl-messages.po
3. `perl translate install zh-Hans-CN` should results in
   po/zh_CN/LC_MESSAGES/Koha.mo and po/zh-Hans-CN-messages.po
4. `perl translate install fr-FR` should results in
   po/fr_FR/LC_MESSAGES/Koha.mo and po/fr-FR-messages.po

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #70976|0   |1
is obsolete||

--- Comment #72 from Julian Maurice  ---
Created attachment 71950
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71950=edit
Bug 15395: Remove the use of Locale::Util's set_locale

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #70974|0   |1
is obsolete||

--- Comment #70 from Julian Maurice  ---
Created attachment 71948
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71948=edit
Bug 15395: Example usage of I18N Template::Toolkit plugin

Moved this patch for example usage to teh end of patch set
and resolved minor conflict while applyin
Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #62333|0   |1
is obsolete||

--- Comment #69 from Julian Maurice  ---
Created attachment 71947
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71947=edit
Bug 15395: Search .js files in more directories

Specifically, koha-tmpl/intranet-tmpl/prog/js and
koha-tmpl/opac-tmpl/bootstrap/js

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #62332|0   |1
is obsolete||

--- Comment #68 from Julian Maurice  ---
Created attachment 71946
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71946=edit
Bug 15395: Make Koha::I18N work with Plack + add tests

Language detection was done in a BEGIN block so it was not working correctly
with Plack. This is now done when the first translation is requested.

This patch also fixes a bug when set_locale(LC_ALL, ...) fails for some reasons
(locale is not installed system-wide for example).

And finally, add some unit tests

Test plan:
1. prove t/Koha/I18N.t
2. Replay the previous test plans with plack enabled

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #62331|0   |1
is obsolete||

--- Comment #67 from Julian Maurice  ---
Created attachment 71945
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71945=edit
Bug 15395: Fix output of msgcat

By default, msgcat tries to merge translations when two or more files have the
same msgid, even for the header (msgid ""). This resulted in an invalid PO file
("#-#-#-#-#" markers in header).
This patch tells msgcat to use the first available translation instead.

Also, this patch set correctly the Project-Id-Version field

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #62330|0   |1
is obsolete||

--- Comment #66 from Julian Maurice  ---
Created attachment 71944
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71944=edit
Bug 15395: Fix PO header reading in po2json

Since version 0.24 Locale::PO do not escape newline characters in string
returned by dequote()
This patch set the required version of Locale::PO to 0.24 and fix po2json

https://rt.cpan.org/Public/Bug/Display.html?id=96016
Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more

2018-02-19 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice  changed:

   What|Removed |Added

  Attachment #62328|0   |1
is obsolete||

--- Comment #64 from Julian Maurice  ---
Created attachment 71942
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71942=edit
Bug 15395: Add plural translation capabilities to JS files

It adds Javascript equivalent of Koha::I18N's exported subroutines, and
they are used the same way.

String extraction is done only on *.js files and require gettext 0.19
(available in Debian stable, and also in wheezy-backports)

It adds Javascript library Gettext.js for handling translation and a
Perl script po2json to transform PO file into JSON.

Gettext.js and po2json both come from Locale::Simple.
There are several tools named po2json. It's simpler to integrate this
one into Koha than to check if the good one is installed on the system.
Locale::Simple is not needed.

To avoid polluting the global namespace too much, this patch also
introduce a global JS object named Koha and add some stuff in Koha.i18n

Test plan:
1. Add a translatable string in a JS file. For example, add this:
 alert(__nx("There is one item", "There are {count} items", 3,
 {count: 3}));
   to staff-global.js
2. cd misc/translator && ./translate update fr-FR
3. Open misc/translator/po/fr_FR/LC_MESSAGES/Koha.po, verify that your
   string is present, and translate it
4. cd misc/translator && ./translate install fr-FR
5. (Optional) Verify that
   koha-tmpl/intranet-tmpl/prog/fr-FR/js/locale_data.js exists and
   contains your translation
6. Open your browser on the staff main page, change language and verify
   that the message is translated
7. Repeat 1-6 on OPAC side

Signed-off-by: Marc Véron 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

  1   2   >