Bug 159631 - ScriptForge.L10N service don't support Plural-Forms from correct .po file
Summary: ScriptForge.L10N service don't support Plural-Forms from correct .po file
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
24.2.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: ScriptForge
  Show dependency treegraph
 
Reported: 2024-02-07 22:49 UTC by Racho
Modified: 2024-02-08 15:37 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Racho 2024-02-07 22:49:57 UTC
Description:
I would like to use plural translation in the Basic extension, but all attempts to force the GetText method to read the plural form of the translation from .po file ended in failure. Perhaps ScriptForge.L10N service does not support this feature - please confirm or deny. If indeed it does not support it, perhaps such functionality could be added.

Actual Results:
Plural-Forms from .po file aren't return by GetText method of ScriptForge.L10N service.

Expected Results:
GetText is reading plural form of translaton string.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.0.3 (X86_64) / LibreOffice Community
Build ID: da48488a73ddd66ea24cf16bbc4f7b9c08e9bea1
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: pl-PL (pl_PL); UI: pl-PL
Calc: threaded
Comment 1 Rafael Lima 2024-02-08 12:10:43 UTC
Unfortunatelly msgid_plural is not supported. In ScriptForge's source code (which you can see in ScriptForge.SF_L10N module under Application Macros), in line 74 there's the comment:

'''	NB: plural forms are not supported

@JPL do you think it's possible to consider this enhancement for the L10N service?
Comment 2 Racho 2024-02-08 12:15:35 UTC
(In reply to Rafael Lima from comment #1)
> Unfortunatelly msgid_plural is not supported.

Thank you!
Comment 3 Jean-Pierre Ledure 2024-02-08 13:33:12 UTC
(In reply to Rafael Lima from comment #1)
> @JPL do you think it's possible to consider this enhancement for the L10N
> service?

I refer to https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html

Let's distinguish:

- "simple" plural forms: one form for a single value, another for >1 values.
This could be implemented if enough demands are expressed through this channel. However a simple workaround is to put 2 Gettext() statements in an
   If ... = 1 Then ... Else ... End If
structure.

- complex plural forms where another translation is selected based on a formula. The number of concerned languages is low. Syntax analysis of the formula could lead to complex coding in Basic. I would not recommend tp make such a development, except, again, if there is a significant demand.
Comment 4 Racho 2024-02-08 15:23:30 UTC
(In reply to Jean-Pierre Ledure from comment #3)
> (In reply to Rafael Lima from comment #1)
> > @JPL do you think it's possible to consider this enhancement for the L10N
> > service?
> 
> I refer to
> https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-
> forms.html
> 
> Let's distinguish:
> 
> - "simple" plural forms: one form for a single value, another for >1 values.
> This could be implemented if enough demands are expressed through this
> channel. However a simple workaround is to put 2 Gettext() statements in an
>    If ... = 1 Then ... Else ... End If
> structure.
> 
> - complex plural forms where another translation is selected based on a
> formula. The number of concerned languages is low. Syntax analysis of the
> formula could lead to complex coding in Basic. I would not recommend tp make
> such a development, except, again, if there is a significant demand.

You are right, I make it this one line in basic, for Polish:

PluralForm = iif(Count = 1, "[0]", iif(Count mod 10>=2 and Count mod 10<=4 and (Count mod 100<10 or Count mod 100>=20), "[1]", "[2]"))

My ask was to don't do it if it's in service.
Comment 5 Racho 2024-02-08 15:37:40 UTC
But you might want to give to https://help.libreoffice.org/latest/pl/text/sbasic/shared/03/sf_l10n.html?DbPAR=BASIC#bm_id571585843652319 information that it does not support msgid_plural