mirror of https://github.com/vitalif/openscad
Support linux packaging structure with shared locale folder.
parent
cfe14254d4
commit
8f2491cd0a
11
openscad.pro
11
openscad.pro
|
@ -11,8 +11,15 @@
|
|||
# qmake Variables to define the installation:
|
||||
#
|
||||
# PREFIX defines the base installation folder
|
||||
#
|
||||
# LOCALE_PREFIX can overwrite the location of the gettext message catalogs
|
||||
#
|
||||
# For linux packages that want to install the localization files into
|
||||
# a folder shared by all packages, specify the LOCALE_PREFIX which will
|
||||
# force usage of the given folder.
|
||||
# The default layout is created by: LOCALE_PREFIX=<prefix>/share/locale
|
||||
# where <prefix> is the base installation folder.
|
||||
#
|
||||
# Please see the 'Building' sections of the OpenSCAD user manual
|
||||
# for updated tips & workarounds.
|
||||
#
|
||||
|
@ -479,7 +486,9 @@ target.path = $$PREFIX/bin/
|
|||
INSTALLS += target
|
||||
|
||||
LINGUAS = $$cat(po/LINGUAS)
|
||||
isEmpty(LOCALE_PREFIX):LOCALE_PREFIX = $$PREFIX/share/openscad/po
|
||||
|
||||
!isEmpty(LOCALE_PREFIX): DEFINES += LOCALE_PREFIX=\'\"$$LOCALE_PREFIX\"\'
|
||||
isEmpty(LOCALE_PREFIX): LOCALE_PREFIX = $$PREFIX/share/openscad/locale
|
||||
for(language, LINGUAS) {
|
||||
catalog = po/$$language/LC_MESSAGES/openscad.mo
|
||||
exists($$catalog) {
|
||||
|
|
|
@ -326,14 +326,14 @@ case $OS in
|
|||
EXAMPLESDIR=OpenSCAD.app/Contents/Resources/examples
|
||||
LIBRARYDIR=OpenSCAD.app/Contents/Resources/libraries
|
||||
FONTDIR=OpenSCAD.app/Contents/Resources/fonts
|
||||
TRANSLATIONDIR=OpenSCAD.app/Contents/Resources/po
|
||||
TRANSLATIONDIR=OpenSCAD.app/Contents/Resources/locale
|
||||
;;
|
||||
UNIX_CROSS_WIN)
|
||||
cd $OPENSCADDIR
|
||||
EXAMPLESDIR=$DEPLOYDIR/openscad-$VERSION/examples/
|
||||
LIBRARYDIR=$DEPLOYDIR/openscad-$VERSION/libraries/
|
||||
FONTDIR=$DEPLOYDIR/openscad-$VERSION/fonts/
|
||||
TRANSLATIONDIR=$DEPLOYDIR/openscad-$VERSION/po/
|
||||
TRANSLATIONDIR=$DEPLOYDIR/openscad-$VERSION/locale/
|
||||
rm -rf $DEPLOYDIR/openscad-$VERSION
|
||||
mkdir $DEPLOYDIR/openscad-$VERSION
|
||||
;;
|
||||
|
@ -341,7 +341,7 @@ case $OS in
|
|||
EXAMPLESDIR=openscad-$VERSION/examples/
|
||||
LIBRARYDIR=openscad-$VERSION/libraries/
|
||||
FONTDIR=openscad-$VERSION/fonts/
|
||||
TRANSLATIONDIR=openscad-$VERSION/po/
|
||||
TRANSLATIONDIR=openscad-$VERSION/locale/
|
||||
rm -rf openscad-$VERSION
|
||||
mkdir openscad-$VERSION
|
||||
;;
|
||||
|
@ -384,8 +384,8 @@ fi
|
|||
if [ -n $TRANSLATIONDIR ]; then
|
||||
echo $TRANSLATIONDIR
|
||||
mkdir -p $TRANSLATIONDIR
|
||||
tar cvf translations.tar po/*/*/*.mo
|
||||
cd $TRANSLATIONDIR/.. && tar xvf $OPENSCADDIR/translations.tar && cd $OPENSCADDIR
|
||||
cd po && tar cvf $OPENSCADDIR/translations.tar */*/*.mo && cd $OPENSCADDIR
|
||||
cd $TRANSLATIONDIR && tar xvf $OPENSCADDIR/translations.tar && cd $OPENSCADDIR
|
||||
rm -f translations.tar
|
||||
fi
|
||||
|
||||
|
|
|
@ -161,10 +161,15 @@ static void info()
|
|||
* files.
|
||||
*/
|
||||
void localization_init() {
|
||||
fs::path po_dir = get_resource_dir("po");
|
||||
if (fs::is_directory(po_dir)) {
|
||||
#ifdef LOCALE_PREFIX
|
||||
std::string locale_path(LOCALE_PREFIX);
|
||||
#else
|
||||
fs::path po_dir = get_resource_dir("locale");
|
||||
std::string locale_path(po_dir.string());
|
||||
#endif
|
||||
if (fs::is_directory(locale_path)) {
|
||||
setlocale(LC_ALL,"");
|
||||
bindtextdomain("openscad", po_dir.string().c_str());
|
||||
bindtextdomain("openscad", locale_path.c_str());
|
||||
bind_textdomain_codeset("openscad", "UTF-8");
|
||||
textdomain("openscad");
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue