Skip to content
Snippets Groups Projects
Verified Commit d563eee3 authored by Martin Sjölund's avatar Martin Sjölund
Browse files

Add linguist lab

parent 28466a32
Branches
Tags
No related merge requests found
*-main.c *-main.c*
*.mo *.mo
gettext gettext
*.qm
qt-linguist
Makefile.linguist
QT += core
TARGET = qt-linguist
SOURCES += linguist-main.cpp setuplocale.c linguist.cpp
TRANSLATIONS = example_sv.ts
all: gettext-main.c linguist-main.c .PHONY: qt-linguist
all: gettext-main.c linguist-main.cpp gettext qt-linguist
gettext: gettext-main.c setuplocale.c gettext.c gettext: gettext-main.c setuplocale.c gettext.c
gettext-main.c: base.c gettext-main.c: base.c
cp $< $@ cp $< $@
linguist-main.c: base.c linguist-main.cpp: base.c
cp $< $@ cp $< $@
qt-linguist: Makefile.linguist
$(MAKE) -f Makefile.linguist
Makefile.linguist: Linguist.pro
qmake -o $@ $<
#include <stdio.h> #include <stdio.h>
#if __cplusplus
extern "C" void setuplocale();
#else
void setup(); void setup();
void setuplocale(); void setuplocale();
#endif
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
setuplocale(); setuplocale();
#if __cplusplus
/* For Qt: Your code here as it is more convenient than a separate function in C++.
* Setup a QCoreApplication (an application without GUI) and install a translator.
*/
#else
setup(); setup();
/* TODO: You need to update this code to output translated strings #endif
/* You need to update this code to output translated strings
* Note that you should make gettext-main.c linguist-main.c and modify * Note that you should make gettext-main.c linguist-main.c and modify
* those files rather than base.c * those files rather than base.c
*/ */
printf("The current language is the default (C/POSIX)\n"); puts("The current language is the default (C/POSIX)\n");
printf("The horse can run.\n"); puts("The horse can run.\n");
printf("How fast can the horse run?\n"); puts("How fast can the horse run?\n");
printf("It typically runs at speed of less than 50 km/h.\n"); puts("It typically runs at speed of less than 50 km/h.\n");
return 0; return 0;
} }
#include <locale.h>
#include <libintl.h> #include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
void setup() void setup()
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment