GResource, GtkBuilder and gettext translations - resources

I'm using Meson (with glib gettext preset) to bundle GtkBuilder files in a GResource file, but I can't figure how to get gettext to recognize the translatable strings.
I've marked the strings with the translatable attribute, put the domain attribute on the <interface> element and listed the file in my GResource xml and POTFILE, but the strings don't appear in the generated pot.
I've seen a number of projects in C such as this one which don't use the domain attribute on the interface, but either way I get no results.
How can I get my translatable GtkBuilder files to be recognized?

Related

Wrong source maps created by Libsass for CSS files in a JSF project

I'm using Libsass (by means of libsass-maven-plugin) for compiling SASS files into CSS files in a JSF project. The outputStyle is "compressed".
The resultant source maps are apparently wrong - when inspecting something in a browser, it often points to a wrong source file. Why is this happening?
During the build Libsass evaluates the provided CSS files, and references their code in the created source maps in the form of encoded line and column numbers.
The "compressed" outputStyle means that all code is in a single line, so the source maps are forced to rely on column numbers only.
Now, JSF CSS files often contain EL resource expressions like this:
.ui-icon-info {
background-image: url("#\{resource['images/info.png']}");
}
These expressions are evaluated in runtime and replaced with URLs. This means that served CSS is different from the one that Libsass based its source maps on. That's why the maps are wrong - their column number references no longer match.
A possible workaround could be to use an outputStyle other than "compressed", e.g. "expanded". Then at least the line numbers are correct, that should be good enough. Just don't break those EL expressions into multiple lines.

List of all BibTex entries in a .bib file, to generate Hakyll publication list?

I'm making a personal website with Hakyll, and I'd like to list my publications.
I've found this module and this guide for how to print the references from a markdown document at the bottom.
The problem with this is, it assumes you've got some document, where you cite all the things you want printed.
What I want is to generate a document that lists every document my .bib file. In particular:
I don't want to have to manually write the bibtex name of each publication I want listed
I just want the "references" section printed, i.e. there's no place in the document where the publication is referenced, they're just listed at the end.
Is it possible to get this information from the Hakyll.Web.Pandoc.Biblio module? Or do I need to separately parse the .bib file to get this? And once I do, how would I make go about generating this page with Hakyll?
You could use this trick from the pandoc's manual, the equivalent of biblatex's \nocite{*}:
It is possible to create a bibliography with all the citations,
whether or not they appear in the document, by using a wildcard:
---
nocite: |
#*
---

Docx4j, there is no prefix registered for Bibliography

I'm trying to add bibliography & citation to docx file using Docx4j. However the XML generated by library has automatically created namespace:
<ns30:Source>
MS Word unfortunetely doesnt show such kind of source as a source. After some trials & erros I discovered that enough is to change the namespace:
<b:Source>
Probably the problem is that in Docx4J this namespace is not defined in NamespacePrefixMappings class.
How Can I add or define my own namespace prefix mappings? Or can I somehow force Docx4j for using particular prefix for part? Anything where the result will be XML with namespace "b" will be good advice for me. I would like to avoid downloading Docx4j source, modyfing source and having customized version of library.
http://www.docx4java.org/docx4j/docx4j-3.3.0-SNAPSHOT-20151020.jar contains https://github.com/plutext/docx4j/commit/089bce035e847dc473b95080a7106f35470fa48e which adds the mapping to NamespacePrefixMappings

How can I perform Search&Replace on an XML file after WIX installation?

After installing my files using WIX 3.5 I would like to changes some values in one of my xml files.
Currently there are multiple entries like this:
<endpoint address="net.tcp://localhost/XYZ" .../>
I would like to change the localhost to the real servername wich is available due to a property. How can I perform this replacement on each entry inside this xml file? Is there a way to do this without writing an own CA?
Thanks in advance!
XmlConfig and/or XmlFile elements are your friends here.
UPDATE: Well, according to the comments below, it turns out that only part of the attribute (or element) value should be changed. This seems not to be supported by either of two referenced elements.
I would take one of the two approaches then:
Use third-party "read XML" actions, like this one
It's better than creating your own because you can rely on deeper testing in this case
Teach your build script to control the string pattern
Let's say you put `net.tcp://localhost/XYZ` to build file and your code is pointed out to take this value as a string pattern to use at install time. For instance, keep the string pattern as a Property in your MSI package. When it changes, e.g. to `net.tcp://localhost/ABC` you'll have to change nothing in your action. In this case from a XMLFile perspective you always know your FROM and TO attribute values.
If your XML configuration file is not large, you can load the file into memory and perform replace using JScript.
var s = "<endpoint address=\"net.tcp://localhost/XYZ\" .../>";
var re = /"net.tcp:\/\/localhost\//g;
var r = s.replace(re, "\"http://newhost.com/");
Here s is your complete XML file, re is the regular expression, and r would contain the result or replace.
You can read and write to public properties of Windows Installer using JScript. Yet there's still one problem: you have to read your XML file and to write it back to disk. To do it, you can use Win32_ReadFile and Win32_WriteFile custom actions from the AppSecInc. MSI Extensions library referenced by Yan in his answer.
However, it could be easier to write a complete Custom Action which will load your XML configuration file, do the replace, and write the file back to disk. To do it you can use XSLT and JScript (see an example code).
InstallShield has a built-in data driven custom action called Text Search. It basically allows for RegEx style replacements like what you are describing.
WiX doesn't have this functionality but you could write a custom action ( say using C#/DTF ) to do it for you.
There nothing in Wix, you can do to change something in a file without using a custom action. If you don't want to use CA, you can consider saving the settings in some other place e.g. User's registry and always read that setting from there

When generating SubSonic DAL, is it possible to have .gen.cs in the generated filenames?

When generating my DAL files with SubSonic, I'd like the names of the files to be .gen.cs. The main reason for this is that the files are partial classes, and I would like to add some additional implementation details into another source file for the table called .cs. This is somewhat the standard pattern for generated source files , and I'm wondering if its possible with SubSonic? I'm using SubSonic 2.2.
I thought you might be able to do this by using a set of custom templates, but the CS_ClassTemplate.aspx (or VB_ClassTemplate.aspx) doesn't control the file name of the class.
I don't think this is possible.
As an alternative, you can do what I do. I have a "generated" directory, such as \database\generated and then I put my partial classes at \database\custom. As long as the namespaces of the files in the two different directories match (like .database or whatever), then it works fine. By using two different directories, it's easier to find your custom files without looking at the generated ones.

Resources