specific target to gettext

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

specific target to gettext

alexis lameire
Hi, I've spent weeks and weeks to solve this problem, but I haven't got any solution yet. that's why I need your help. My project uses gettext for localization, and cmake for build. I'd like to set a make target to automatically generate .pot files and update .po files, and another one to compile the .po files to .mo files and write them in the "bin" subdirectory of my project root.with the standard tree of gettext . How to do this? Thaks for your help

Discutez sur Messenger où que vous soyez ! Mettez Messenger sur votre mobile !
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: specific target to gettext

John Drescher-2
On Sat, Jul 25, 2009 at 7:20 PM, alexis
lameire<[hidden email]> wrote:
> Hi, I've spent weeks and weeks to solve this problem, but I haven't got any
> solution yet. that's why I need your help. My project uses gettext for
> localization, and cmake for build. I'd like to set a make target to
> automatically generate .pot files and update .po files, and another one to
> compile the .po files to .mo files and write them in the "bin" subdirectory
> of my project root.with the standard tree of gettext . How to do this? Thaks
> for your help
>

Check out add_custom_command

http://cmake.org/cmake/help/cmake2.6docs.html#command:add_custom_command

John
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: specific target to gettext

John Drescher-2
> thenks
> i have try it but i have this error when i make
> CMakeFiles/update_pot.dir/build.make:50: *** les commandes commencent avant
> la première cible. Arrêt.
> make[2]: *** [CMakeFiles/update_pot.dir/all] Erreur 2
> make[1]: *** [CMakeFiles/update_pot.dir/rule] Erreur 2
> make: *** [update_pot] Erreur 2
> http://pastie.org/559051 : my CMakeListe.txt :) sorry if the pastbin is not
> the good solution but i never yet use mailling list
>

Make sure you send your replies to the list also. I will try to look
at this as soon as I can. Pastebin is fine.

John
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: specific target to gettext

alexis lameire
In reply to this post by John Drescher-2



From: [hidden email]
To: [hidden email]
Subject: RE: [CMake] specific target to gettext
Date: Sun, 26 Jul 2009 00:30:49 +0000



> Date: Sat, 25 Jul 2009 19:42:58 -0400
> Subject: Re: [CMake] specific target to gettext
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
>
> On Sat, Jul 25, 2009 at 7:20 PM, alexis
> lameire<[hidden email]> wrote:
> > Hi, I've spent weeks and weeks to solve this problem, but I haven't got any
> > solution yet. that's why I need your help. My project uses gettext for
> > localization, and cmake for build. I'd like to set a make target to
> > automatically generate .pot files and update .po files, and another one to
> > compile the .po files to .mo files and write them in the "bin" subdirectory
> > of my project root.with the standard tree of gettext . How to do this? Thaks
> > for your help
> >
>
> Check out add_custom_command
>
> http://cmake.org/cmake/help/cmake2.6docs.html#command:add_custom_command
>
> John

thenks
i have try it but i have this error when i make
CMakeFiles/update_pot.dir/build.make:50: *** les commandes commencent avant la première cible. Arrêt.
make[2]: *** [CMakeFiles/update_pot.dir/all] Erreur 2
make[1]: *** [CMakeFiles/update_pot.dir/rule] Erreur 2
make: *** [update_pot] Erreur 2
http://pastie.org/559051 : my CMakeListe.txt :) sorry if the pastbin is not the good solution but i never yet use mailling list


Votre correspondant a choisi Hotmail et profite d'un stockage quasiment illimité. Créez un compte Hotmail gratuitement !

Souhaitez vous  « être au bureau sans y être » ? Oui je le veux !
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: specific target to gettext

alexis lameire





From: [hidden email]
To: [hidden email]
Date: Sun, 26 Jul 2009 11:01:46 +0000
Subject: Re: [CMake] specific target to gettext




From: [hidden email]
To: [hidden email]
Subject: RE: [CMake] specific target to gettext
Date: Sun, 26 Jul 2009 00:30:49 +0000



> Date: Sat, 25 Jul 2009 19:42:58 -0400
> Subject: Re: [CMake] specific target to gettext
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
>
> On Sat, Jul 25, 2009 at 7:20 PM, alexis
> lameire<[hidden email]> wrote:
> > Hi, I've spent weeks and weeks to solve this problem, but I haven't got any
> > solution yet. that's why I need your help. My project uses gettext for
> > localization, and cmake for build. I'd like to set a make target to
> > automatically generate .pot files and update .po files, and another one to
> > compile the .po files to .mo files and write them in the "bin" subdirectory
> > of my project root.with the standard tree of gettext . How to do this? Thaks
> > for your help
> >
>
> Check out add_custom_command
>
> http://cmake.org/cmake/help/cmake2.6docs.html#command:add_custom_command
>
> John

thenks
i have try it but i have this error when i make
CMakeFiles/update_pot.dir/build.make:50: *** les commandes commencent avant la première cible. Arrêt.
make[2]: *** [CMakeFiles/update_pot.dir/all] Erreur 2
make[1]: *** [CMakeFiles/update_pot.dir/rule] Erreur 2
make: *** [update_pot] Erreur 2
http://pastie.org/559051 : my CMakeListe.txt :) sorry if the pastbin is not the good solution but i never yet use mailling list


Votre correspondant a choisi Hotmail et profite d'un stockage quasiment illimité. Créez un compte Hotmail gratuitement !

Souhaitez vous  « être au bureau sans y être » ? Oui je le veux !

i have search and found the solution at the proble !
i can write the first target but it's not satisfy me completly :
i would like remove the -j open if the file don't exist !
i would like be sure that the executable that i use exist on the hote system
http://pastie.org/559719 : my CMakeList.txt






Souhaitez vous  « être au bureau sans y être » ? Oui je le veux !
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: specific target to gettext

alexis lameire
In reply to this post by alexis lameire
grumf :/
i have try this, can you help me to look what that don't match
http://pastie.org/561035

he don't compile the po file :/ and i don't found the mo target dependancies

From: [hidden email]
To: [hidden email]
Subject: RE: [CMake] specific target to gettext
Date: Sun, 26 Jul 2009 23:56:46 +0000






From: [hidden email]
To: [hidden email]
Date: Sun, 26 Jul 2009 11:01:46 +0000
Subject: Re: [CMake] specific target to gettext




From: [hidden email]
To: [hidden email]
Subject: RE: [CMake] specific target to gettext
Date: Sun, 26 Jul 2009 00:30:49 +0000



> Date: Sat, 25 Jul 2009 19:42:58 -0400
> Subject: Re: [CMake] specific target to gettext
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
>
> On Sat, Jul 25, 2009 at 7:20 PM, alexis
> lameire<[hidden email]> wrote:
> > Hi, I've spent weeks and weeks to solve this problem, but I haven't got any
> > solution yet. that's why I need your help. My project uses gettext for
> > localization, and cmake for build. I'd like to set a make target to
> > automatically generate .pot files and update .po files, and another one to
> > compile the .po files to .mo files and write them in the "bin" subdirectory
> > of my project root.with the standard tree of gettext . How to do this? Thaks
> > for your help
> >
>
> Check out add_custom_command
>
> http://cmake.org/cmake/help/cmake2.6docs.html#command:add_custom_command
>
> John

thenks
i have try it but i have this error when i make
CMakeFiles/update_pot.dir/build.make:50: *** les commandes commencent avant la première cible. Arrêt.
make[2]: *** [CMakeFiles/update_pot.dir/all] Erreur 2
make[1]: *** [CMakeFiles/update_pot.dir/rule] Erreur 2
make: *** [update_pot] Erreur 2
http://pastie.org/559051 : my CMakeListe.txt :) sorry if the pastbin is not the good solution but i never yet use mailling list


Votre correspondant a choisi Hotmail et profite d'un stockage quasiment illimité. Créez un compte Hotmail gratuitement !

Souhaitez vous  « être au bureau sans y être » ? Oui je le veux !

i have search and found the solution at the proble !
i can write the first target but it's not satisfy me completly :
i would like remove the -j open if the file don't exist !
i would like be sure that the executable that i use exist on the hote system
http://pastie.org/559719 : my CMakeList.txt






Souhaitez vous  « être au bureau sans y être » ? Oui je le veux !

Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ? Lancez-vous !
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: specific target to gettext

Hendrik Sattler
Hi,

please don't top-post.

Zitat von alexis lameire <[hidden email]>:
> grumf :/
> i have try this, can you help me to look what that don't match
> http://pastie.org/561035
>
> he don't compile the po file :/ and i don't found the mo target dependancies

You do lot's of things wrong there:
include(FindGettext)
find_package(Gettext)
is not correct: delete the include() line.

link_directories(
       ${USE_gcrypt_LIBRARY}
       ${USE_glib2_LIBRARY}
       ${USE_ircclient_LIBRARY}
       ${SQLITE_LIBRARIES}
)
is most certainly not the right thing to do. It is not possible to  
look into the values of the variables but the probably contain file  
paths not directories. Link_directories() is no necessary if libraries  
are given with full path!

target_link_libraries(
         d7c
         ${LIBRARIES}
         sqlite3
)
Why are you using "sqlite3" here and not "${SQLITE_LIBRARIES}" from above?

add_custom_target(
       update_pot
       COMMAND xgettext -d ${package_name} -s -o
         ${package_name}.pot ./src/*.c -p ./po
         --from-code=utf-8 -j
         --keyword=_
         --package-name=${package_name}
         --package-version=${package_version}
         --msgid-bugs-address=${email_report}
)
You are missing the dependency on the source files here. You should  
not list them as src/*.c, instead use the ones from the d7c target.
You should also use full path names (variables for current build and  
current source directory exist) for input and output files. Since you  
create the .pot file on every build, you should not create it in the  
source directory but in the build directory instead. (but see below)

add_custom_command(
     TARGET update_pot
     COMMAND msgmerge --update ${po_files} ./po/${package_name}.pot
   )
You are missing the dependency on the pot file here.
Additionally, you pollute the source directory with changed files on  
every build :-(
Additionally, msgmerge can only handle _one_ .po file at a time.
You should also use full path names (variables for current build and  
current source directory exist). Same for also all others command.  
(but see below)

#ajout d'un fichier po
add_custom_target(
   create_po
   COMMAND msginit -l $(LANGUAGE) -o ./po/$(LANGUAGE).po -i  
./po/${package_name}.pot
)
What if the .po file already exists. You will overwrite in in this  
case: not good. The dependency on the .pot file is missing. (see below)


Generally:
1.
list all files that you use as dependencies to make it work. Else,  
make (not cmake) cannot determine the build order automatically and  
will eventually fail.

2.
Don't make it yourself too easy by using file(GLOB ....). That is not  
a good approach. It will give you major pain if you want to e.g.  
exlude some files from the build.

3. Don't create the .pot file on every build and don't merge it in the  
.po files as that always needs manual work afterwards. If it doesn't,  
then the two command were no-ops anyway. So: xgettext, msgmerge and  
msginit are a totally separate task that you do not need at  
build-time. Instead, they should be part of the development process,  
not of the build process.
So the only thing left is msgfmt. And that one is easy.

HS


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: specific target to gettext

alexis lameire


> Date: Tue, 28 Jul 2009 09:20:39 +0200
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
> Subject: Re: [CMake] specific target to gettext
>
> Hi,
>
> please don't top-post.
>
> Zitat von alexis lameire <[hidden email]>:
> > grumf :/
> > i have try this, can you help me to look what that don't match
> > http://pastie.org/561035
> >
> > he don't compile the po file :/ and i don't found the mo target dependancies
>
> You do lot's of things wrong there:
> include(FindGettext)
> find_package(Gettext)
> is not correct: delete the include() line.
>
> link_directories(
> ${USE_gcrypt_LIBRARY}
> ${USE_glib2_LIBRARY}
> ${USE_ircclient_LIBRARY}
> ${SQLITE_LIBRARIES}
> )
> is most certainly not the right thing to do. It is not possible to
> look into the values of the variables but the probably contain file
> paths not directories. Link_directories() is no necessary if libraries
> are given with full path!
>
> target_link_libraries(
> d7c
> ${LIBRARIES}
> sqlite3
> )
> Why are you using "sqlite3" here and not "${SQLITE_LIBRARIES}" from above?
>
> add_custom_target(
> update_pot
> COMMAND xgettext -d ${package_name} -s -o
> ${package_name}.pot ./src/*.c -p ./po
> --from-code=utf-8 -j
> --keyword=_
> --package-name=${package_name}
> --package-version=${package_version}
> --msgid-bugs-address=${email_report}
> )
> You are missing the dependency on the source files here. You should
> not list them as src/*.c, instead use the ones from the d7c target.
> You should also use full path names (variables for current build and
> current source directory exist) for input and output files. Since you
> create the .pot file on every build, you should not create it in the
> source directory but in the build directory instead. (but see below)
>
> add_custom_command(
> TARGET update_pot
> COMMAND msgmerge --update ${po_files} ./po/${package_name}.pot
> )
> You are missing the dependency on the pot file here.
> Additionally, you pollute the source directory with changed files on
> every build :-(
> Additionally, msgmerge can only handle _one_ .po file at a time.
> You should also use full path names (variables for current build and
> current source directory exist). Same for also all others command.
> (but see below)
>
> #ajout d'un fichier po
> add_custom_target(
> create_po
> COMMAND msginit -l $(LANGUAGE) -o ./po/$(LANGUAGE).po -i
> ./po/${package_name}.pot
> )
> What if the .po file already exists. You will overwrite in in this
> case: not good. The dependency on the .pot file is missing. (see below)
>
>
> Generally:
> 1.
> list all files that you use as dependencies to make it work. Else,
> make (not cmake) cannot determine the build order automatically and
> will eventually fail.
>
> 2.
> Don't make it yourself too easy by using file(GLOB ....). That is not
> a good approach. It will give you major pain if you want to e.g.
> exlude some files from the build.
>
> 3. Don't create the .pot file on every build and don't merge it in the
> .po files as that always needs manual work afterwards. If it doesn't,
> then the two command were no-ops anyway. So: xgettext, msgmerge and
> msginit are a totally separate task that you do not need at
> build-time. Instead, they should be part of the development process,
> not of the build process.
> So the only thing left is msgfmt. And that one is easy.
>
> HS
>
thenks i have not all understand but i have try this :)
http://pastie.org/561548
i don't understand the problem of create_pot and update_po target :)
i wouldn't this target launch at all :)  it's easyeast to me to have this target :) and more proper them a bash script :)
at this time the mo file don't created correctly :/ why ?

i don't understand why pot file pollute the po dir :) it's a source file (genereted automaticily cert but a source file needed to do po file :))
i have correct the library_dirrectory and the name of variable :)
if you can look again lot thanks for your help




Discutez sur Messenger où que vous soyez ! Mettez Messenger sur votre mobile !
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: specific target to gettext

Alexander Neundorf-3
On Tuesday 28 July 2009, alexis lameire wrote:
...
> thenks i have not all understand but i have try this :)
> http://pastie.org/561548
> i don't understand the problem of create_pot and update_po target :)
> i wouldn't this target launch at all :)  it's easyeast to me to have this
> target :) and more proper them a bash script :) at this time the mo file
> don't created correctly :/ why ?

You have this:
#gestion de gettext
add_custom_target(
  update_pot
  COMMAND xgettext -d ${package_name} -s -o
    ${package_name}.pot
    ${CMAKE_CURRENT_BINARY_DIR}/${source_file}
    -p ./po
    --from-code=utf-8 -j
    --keyword=_
    --package-name=${package_name}
    --package-version=${package_version}
    --msgid-bugs-address=${email_report}
  DEPENDS ${source_file}
)


I didn't see where source_file is set. Maybe that's the simple reason for
problems you have ?

And at least I would prefer if you put the interesting code directly in the
emails or attach the files. Doesn't stuff posted to pastebin go away after a
few days ?

Alex
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake