Manage poedit synchronization with sources for multiple languages, command-line - gettext

I am using poedit to manage gettext translations in a php project. There are many people contributing to the project and each time some new language strings are added, I need to run poedit and synchronize with source for each language available, so that translators can then translate the language files. My questions are:
a) Do I have to do this every time for each language, or is there an easier way?
b) Is there a way to do this from command-line (so I can add it to a cron job for example)?
Thanks in advance

If this is a pure Gettext project, i.e. not relying on custom extraction provided by poedit then:
Yes you do need to do this every time for each language. But you could choose to use xgettext and create a POT file. Give the POT file to translators who can then do the updates themselves. I think poedit can update from a template within the UI.
You could do this yourself on the command line using xgettext to update your POT file. Then msgmerge to update each individual language file. But then you need to communicate with your translators as they might have been translating the file that you have just updated for them.
From a translators perspective you should try to limit your string churn and create a concept of a string freeze. To have to retranslate things is quite time consuming for translators and as you've discovered for yourself.

Related

Reference / bibliography management in Emacs: helm-bibtex, org-ref, ebib

To manage your bibliography and in-text citations, which tools are best to use in Emacs? I am pretty confused about for instance helm-bibtex, org-ref, and ebib. Are these different packages for the samae thing? Thanks!
org-ref: a reference management system that integrates tightly with org-mode. I think of it like a lightweight Zotero but fully inside emacs (eg you can edit bibtex files, insert citations, search/download PDFs for references, insert bibliographies, etc). The youtube video on the Github page does a pretty good job explaining what it does and its intended workflow.
helm-bibtex: a search tool for .bib files. Execute helm-bibtex and it presents a list of whatever .bib files you configure it to search. When you 'select' something you have the option of navigating to the URL, opening the PDF, inserting the entry as a citation, inserting the BibTeX entry, etc. Also there is another command called ivy-bibtex which is confusingly part of the helm-bibtex package which does the same thing but with ivy. Furthermore, org-ref depends on helm-bibtex so consider the features of the latter to be a subset of the former.
ebib: as far as I can tell this is separate from the other two but looks like it overlaps with org-ref (or at least it has the ability to download PDFs, insert citations, follow URLs, search .bib files, etc). The main difference is that it appears the intention for ebib is to provide a nice tool for editing .bib files themselves, although it can do more than just that.
FWIW I personally use Zotero for managing my .bib files and then search/insert from them with ivy-bibtex/helm-bibtex when writing. I have ebib and org-ref half-configured but I never really needed to use them given that Zotero makes up for alot of the features that don't directly involve writing a manuscript. I also prefer to write in straight LaTeX rather than use org-mode's export functionality (just personal preferences), so this also removes the incentive for me to use org-ref since it seems geared toward writing in org-mode itself.
You can obviously do whatever you want just using Emacs packages and not rely on Zotero at all, but that should give a sense of what functionality each package provides.

Storing Reference Files that Are Not a Part of the Program

I am working on a Firefox extension it is a context menu for automating bbCode, HTML, MarkDown, etc.
It is functional now, but I have a file which is the size of the rest of the code combined, an Excel spreadsheet. (Yes, I know, lame)
I use it as a database for organizing the menu IDs, arguments, internationalization, etc.
It's useful, for me at least, and I want to make it available, but it is not properly a part of the application, it should be a part of the background documentation.
Is there a way in Github/Git to separate documentary files from those that a part of execution of the code?
I've looked through Github, and I haven't found a spot (with revision control) to put this.

Java refactor programmatically

As a process of rebranding, we have a change the names in one of our huge project.
Is there a way that let me refactor my Java code base (rename class and package) programmatically using eclipse/other tools?
Eclipse has a way of persisting refactorings that you apply into an XML file and gives you the possibility to replay this script later, see https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Fconcepts%2Fconcept-refactoring.htm.
It is not that hard to write this script by hand, especially if you're just renaming code (refactoring within a method-body needs much more fine-grained information).

How to put a class-diagram under version control?

I want to upload a class-diagram to a public repository on GitHub.
Is there any tool which is considered to be a convention for this purpose?
Currently, I am using Google Docs, from which I can export a PDF.
Someone has suggested for me to use https://www.draw.io/, from which I can export an XML (which would be a lot more suitable for version control, since it is pure text), but I don't know whether or not this tool is "well accepted" across the community.
All versions control systems work with text files. PDF is not a text file. Forget it. It is the same as putting exe files under version control. VCSs work with source files, don't forget this.
All diagrams editors has inner representations of diagrams in some sort of text file. Eclipse UML editors use XML. So, the versions control systems can easily take these files and work with them.
The problem comes when you have conflicts. You will have to resolve them reading and understanding the inner language of the diagram representation. It could be very difficult.
So, it is possible, but try to minimize the conflicts.

awk powered CMS

I have been lurking for a long time on this forum and I found it to be the most useful. This is my first question so forgive me if it is not phrased properly. I am looking for a simple nawk based (the server doesn't belong to me so I can not install gawk even if I wanted) CMS or collection of shell/awk scripts to help me manage my growing collection of pure XHTML 1.0/CSS files which represent my personal website. I tried TinyTim and Blis on my personal computer. Apart of being non-portable (sorry but Bash and gawk are not standard Unix tools) I found them not to be fully functional. Can anybody suggest any other solutions? I have my own growing collection of quick scripts but I need something more robust. I am willing to consider simple Perl based solution. Python would be a stretch but I really like the language and I am using it daily for scientific computing so I am willing at least to learn about that option.
I wrote a static site generator using awk and sh called Zodiac. It supports Markdown and plain HTML, a main site layout, metadata and its written in POSIX awk and sh. This could be the awk-based content management system you're looking for.
An interesting question! But this is not a traditional answer. I have numerous comments that won't fit well into the S.O. comment format, so please forgive this violation of etiquette.
As much as I like *awk, I can see several obstacles.
1. I'm not aware of any CMS tools created with nawk. I have a wide range of experience of what is available with awk, and as you've discovered, there are several, (TinyTim and Blis), but they're based on bash/gawk and they're not as fully featured as you require.
When I went to the mother-ship of awk (www.awk.info), I got the distinct impression that the site has been hacked. I did find A tiny CMS in awk , but assume it is a gawk based system. The two sites have related authors, so I'm afraid it may be hacked too. Beware!
2. It sounds like you are thinking of a traditional awk command-line and shell script based system. If so, my limited experience with CMS systems has been that they are GUI based systems for content creation and management, so a GUI page creator, AND THEN a GUI wrapper around something similar to a traditional unix repository/SCCS system. CMS experts are welcome to enumerate the differences.
So, why not just make some wrapper scripts around CVS or similar that allow you to control your repository as you need?
3. System effectiveness I: using CVS as a place holder for the repository side of your CMS system, think how big that source code is, and that it is written in 'C', which gives much finer access and control to sub-systems related to file ownership and security issues (as well as many others) than you can access in nawk or any shell. (Compiled C executes much faster of course, but in this day of 3Ghz+ processors, it's not an absolute requirement to insist on complied code)
4. system effectiveness II: You say you want to store mostly XHTML 1.0/CSS type files. That is a major set-back for your project, awk is reg-ex based language and can't effectively parse XML-like data. Have you lurked enough here to have read parse xml in bash OR complex conversions
Of course, the post I was really looking for, I can't find! Search for phrases like 'friends don't let friends do XML in sed/awk/bash' ;-)!
5. Re TinyTim and Blis: Reconsider your objection to gawk/bash: these 2 excellent languages are super-sets of nawk and ksh(88). Depending on how little/much the script rely on gawk/bash specific features, at the easy end, you may only need to change the 'she-bang' at the top of the file to #!/bin/nawk , #!/bin/ksh OR more realistically, make that change and then rewrite some code for nawk/ksh. Worst case is that the gawk and bash code rely so heavily on specific 'branded' features that is really impractical to rewrite. It's worth a look.
To complete the picture, also see gawkxml.
Obviously a gawk system, but I did make a conversion to nawk with some code changes. It worked for my needs, but I didn't try to fix the case of the self-verifying aspect of the code that didn't work ;-(
EDIT
6. Finally, look at the range of systems from the original awk creators in their classic book 'The Awk Programming Language', Chap 4 Reports and Databases, 'A relational database system' AND Chap. 6, Little Languages. There may be ideas there for you (no prebaked CMS however ;-).
So, given that perl and python both have good-to-great XML processing built-in via imported modules, I think you have to seriously consider them OR install something like xmlstarlet (per the S.O. links above) and write your shell system wrappers to work with it.
I hope this helps.
Try Jekyll:
http://jekyllrb.com/
You just write up some text files using some simple, intuitive syntax. Then when you run Jekyll, it generates a whole folder full of plain HTML files, ready to upload.
The code can be extended using Ruby plugins which add extra functionality.
It is supported on GitHub Pages: if you upload a repository full of Markdown files, GitHub will run Jekyll on it automatically and host it on your personal subdomain.
There's also Hyde which is written in Python, but I haven't tried it.
A Google search for "static website generator" will yield millions of results. Try a few and pick what you like!