Recent

Author Topic: Idea for a Lazarus addition: resource string validator  (Read 57846 times)

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Idea for a Lazarus addition: resource string validator
« Reply #30 on: December 22, 2011, 08:24:41 pm »
I added a check for duplicate orginal values (untranslated strings) in the master po-file.

Sources still at http://home.tiscali.nl/~knmg0017/software/gpocheck_bron.zip

@Juha: time to add this to Lazarus tools?
(You can remove the highligher files, it is in trunk already.)

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: po hl [Re: Idea for a Lazarus addition: resource string validator]
« Reply #31 on: December 23, 2011, 12:02:27 am »
It appears in the IDE now (for source editor)
But has empty default colors

If some one has a choice for colors, sent me an export, otherwise I will put in some random colors

I attached a diff for ColourDefault.xml in issue #20953 in the bugtracker.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Idea for a Lazarus addition: resource string validator
« Reply #32 on: December 23, 2011, 05:27:39 pm »
@Juha: time to add this to Lazarus tools?

Bart, is it ok for you if I make it a package? Then it would be registered under Tools menu but source would be under Components directory.
This would allow at least 2 improvements in future:
1. Find automatically and verify the PO files that belong to the current project. This is very intuitive because we are dealing with translations of a Lazarus project always.
2. Use the IDE integration features better. The results window could be part of the editor windows for example.

Those improvements are not necessarily needed now but IMO this should be made a Lazarus IDE package because it works with a Lazarus project.

Juha
« Last Edit: December 23, 2011, 06:16:57 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Idea for a Lazarus addition: resource string validator
« Reply #33 on: December 24, 2011, 01:15:17 pm »
Jha,

Feel free to make it a package.
I would still like to have this tool available as a seperate project for fpc/Lazarus users though...

When you commit the code, credits are appreciated  O:-)

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Idea for a Lazarus addition: resource string validator
« Reply #34 on: December 25, 2011, 03:35:41 pm »
Feel free to make it a package.
I would still like to have this tool available as a seperate project for fpc/Lazarus users though...

When you commit the code, credits are appreciated  O:-)

Ok, I did so. Now the package can be selected in the list of IDE packages. It installs under Tools menu.
Please test.

The stand-alone application version should be maintained somewhere else. Do you have access to CCR? Maybe some external repository?
There could also be project files under the package directory and one could build the application from the same sources.
However, that will not work when the package gets more IDE integration, so I don't consider it a good idea.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Idea for a Lazarus addition: resource string validator
« Reply #35 on: December 25, 2011, 04:23:21 pm »
Ok, I did so. Now the package can be selected in the list of IDE packages. It installs under Tools menu.
Please test.

Will do when I upgrade, may take quit a while though...

The stand-alone application version should be maintained somewhere else. Do you have access to CCR?

No I don't think so.

There could also be project files under the package directory and one could build the application from the same sources.
However, that will not work when the package gets more IDE integration, so I don't consider it a good idea.

As long as the SimplePoFiles and PoFamilies units, which basically do all the reading and testing, remain independent  of the IDE (and I see no reason why they shouldn't) a simple stand-alone version is IMHO still a feasible project to maintain.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Idea for a Lazarus addition: resource string validator
« Reply #36 on: December 26, 2011, 12:09:03 am »
As long as the SimplePoFiles and PoFamilies units, which basically do all the reading and testing, remain independent  of the IDE (and I see no reason why they shouldn't) a simple stand-alone version is IMHO still a feasible project to maintain.

I will look at it. Maybe just the main window should be copied.

I think the shared code also needs more attention. I guess it is a char-encoding problem.
For example "lazaruside.he.po" reports 260 errors in Format params although they look ok.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Idea for a Lazarus addition: resource string validator
« Reply #37 on: December 26, 2011, 12:37:46 am »
I think the shared code also needs more attention. I guess it is a char-encoding problem.
For example "lazaruside.he.po" reports 260 errors in Format params although they look ok.

Took a quick look.
The lazaruside.he.po file says it is UTF-8.
Looking at is, I see severeral s% instead of %s.
I know Hebrew (I guess it is Hebrew, I cannot display the characters on my system) is RTL, but should this affect the %s as I can see them in an UTF-8 capable (SynEdit) editor?

The lazaruside.zh_CN.po file (which is some kind of chinese, I guess, and so also RTL) otoh has only 13 errors in this test.
So maybe the Hebrew translation actually is off???

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Idea for a Lazarus addition: resource string validator
« Reply #38 on: December 26, 2011, 12:49:23 am »
Looking at is, I see severeral s% instead of %s.
I know Hebrew (I guess it is Hebrew, I cannot display the characters on my system) is RTL, but should this affect the %s as I can see them in an UTF-8 capable (SynEdit) editor?

The lazaruside.zh_CN.po file (which is some kind of chinese, I guess, and so also RTL) otoh has only 13 errors in this test.
So maybe the Hebrew translation actually is off???

Right! I didn't look at it carefully.
I don't think the Format function will interpret it correctly either. Right-to-Left languages will need attention in many places.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Idea for a Lazarus addition: resource string validator
« Reply #39 on: December 26, 2011, 01:51:22 am »
I think the lazaruside.he.po file is fawd.

Try this:
Options -> Editor -> Display -> Markup and Colors
In that form there is a slider to set some delaytime. Above it there is a label that says (in English, with dutch locale): (1,50 seconds delay).
This is controlled by the resoucestring "dlgeddelayinsec".

Now set desktop language to Hebrew:

The same label now says ( s), note: the "1,50" is gone.

Also when you do File -> Save As the promt "Delete old file [FileName]" (controlled by "lisdeleteoldfile") now says "s [FileName]"

(I then could not set the language back to English, since on that particular frame all controls were invisible.
I had to manually edit environmentoptions.xml.)

These experiments IMHO show that the languagefile lazaruside.he.po is incorrect.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Idea for a Lazarus addition: resource string validator
« Reply #40 on: January 03, 2012, 04:32:04 pm »
Bart, I added the project files for PoChecker into "Proj" directory. The project uses the same source files except for the main form file which I copied from the package. (Earlier I improved its anchors and layout).
Please test.

The test for duplicate values is broken. If you have an idea how to fix it, please tell me. Otherwise I will learn the code better at some time.
I guess the values should be stored in another hash map.
There are many duplicate values and this feature would be nice.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Idea for a Lazarus addition: resource string validator
« Reply #41 on: January 03, 2012, 05:48:47 pm »
Bart, I added the project files for PoChecker into "Proj" directory. The project uses the same source files except for the main form file which I copied from the package. (Earlier I improved its anchors and layout).
Please test.

I'll test it when I have updated (will take while, busy with other problems)

The test for duplicate values is broken. If you have an idea how to fix it, please tell me. Otherwise I will learn the code better at some time.

What do youmean by broken?

What it tries to do is this:
Only in the master .po file it searches for any duplicate value of an (untranslated) resourcestring.
For this it stores each untranslated string in a separate list.

I roughly tested this with a dummy po-file and it found all duplicates.

e.g.:

Code: [Select]
#: dummy.wiseditform
msgid "&Edit"
msgstr ""

#: dummy.wiseditsource
msgid "&Edit"
msgstr ""

It will warn that the value for dummy.wiseditsource is a duplicate of dummy.wiseditform.
(If it has more than 1 duplicate it will only list the firts one as reference)
If it does not do this, the test is broken.

Maybe I misunderstood the meaning of duplicates in this context.
In that case the test uses the wrong concept and must be re-designed.
In that case please create a dummy master po-file (max 20 entries) with duplicates and explain what is wrong with the file and what the test should report.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Idea for a Lazarus addition: resource string validator
« Reply #42 on: January 03, 2012, 07:54:59 pm »
I testing with the big LazarusIDEStrConsts.
If I load lazaruside.fi.po or lazaruside.po, the checker always says "No errors found".
I know there are many identical strings.

BTW, I have changed the color of "No errors found" to green. Red usually indicates an error.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Idea for a Lazarus addition: resource string validator
« Reply #43 on: January 04, 2012, 02:23:58 am »
In lazaruside.po can you please point out one duplicate (with the corresponding linenumbers) so I can re-test?

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Idea for a Lazarus addition: resource string validator
« Reply #44 on: January 04, 2012, 01:44:25 pm »
In lazaruside.po can you please point out one duplicate (with the corresponding linenumbers) so I can re-test?

at line 3209:
#: lazarusidestrconsts.dlgunitdepbrowse
msgctxt "lazarusidestrconsts.dlgunitdepbrowse"
msgid "Open"

at line 8515:
#: lazarusidestrconsts.lishintopen
msgctxt "lazarusidestrconsts.lishintopen"
msgid "Open"

at line 11126:
#: lazarusidestrconsts.lismenutemplateopen
msgctxt "lazarusidestrconsts.lismenutemplateopen"
msgid "Open"

And there are many others.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018