-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for translation of strings found in darktable styles.
Remove the hack added in view/darkroom.c for two strings now auto-generated.
- Loading branch information
Showing
4 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
STYLE_DIR=$1 | ||
OUT=$2 | ||
|
||
# Get the l10n strings from styles. Such strings are prefixed by _l10n_ | ||
function get-l10n() | ||
{ | ||
# 1. Get the "name" node value using xsltproc | ||
# | ||
# 2. Cut substrings separated with | and keep only those | ||
# with _l10n_ prefix. | ||
# | ||
# 3. Remove all _l10n_ sentinel with sed | ||
# | ||
# 4. Finaly generates into the while loop the pseudo C code for | ||
# the strings to be translated. | ||
|
||
xsltproc <( echo '<?xml version="1.0"?> | ||
<xsl:stylesheet version="1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
<xsl:output indent="yes" omit-xml-declaration="yes"/> | ||
<xsl:template match="info"> | ||
<xsl:value-of select="name"/> | ||
</xsl:template> | ||
<xsl:template match="style"/> | ||
</xsl:stylesheet>' ) $1 | | ||
tr '|' '\n' | grep _l10n_ | sed 's/_l10n_//g' | | ||
while read line; do | ||
echo "_(\"$line\")" | ||
done | ||
} | ||
|
||
export IFS=$'\n' | ||
|
||
{ | ||
echo "// Not to be compiled, generated for translation only" | ||
echo | ||
|
||
# Ensure that we remove the duplicate strings | ||
|
||
ls $STYLE_DIR/*.dtstyle | while read file; do | ||
get-l10n $file | ||
done | sort | uniq | ||
} > $OUT |