Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
42157229
Commit
42157229
authored
13 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
wrc: Store the current po file in a global variable.
parent
268976b9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/wrc/po.c
+35
-35
35 additions, 35 deletions
tools/wrc/po.c
with
35 additions
and
35 deletions
tools/wrc/po.c
+
35
−
35
View file @
42157229
...
...
@@ -393,20 +393,17 @@ static const struct
#ifndef HAVE_LIBGETTEXTPO
typedef
void
*
po_file_t
;
static
const
char
*
get_msgstr
(
po_file_t
po
,
const
char
*
msgid
,
const
char
*
context
,
int
*
found
)
static
const
char
*
get_msgstr
(
const
char
*
msgid
,
const
char
*
context
,
int
*
found
)
{
if
(
context
)
(
*
found
)
++
;
return
msgid
;
}
static
po_file_t
re
ad_po_file
(
const
char
*
name
)
static
void
lo
ad_po_file
(
const
char
*
name
)
{
return
NULL
;
}
static
void
po_file_
free
(
po_file
_t
po
)
static
void
free
_
po_file
(
void
)
{
}
...
...
@@ -422,6 +419,8 @@ void write_po_files( const char *outname )
#else
/* HAVE_LIBGETTEXTPO */
static
po_file_t
po_file
;
static
void
po_xerror
(
int
severity
,
po_message_t
message
,
const
char
*
filename
,
size_t
lineno
,
size_t
column
,
int
multiline_p
,
const
char
*
message_text
)
...
...
@@ -474,13 +473,13 @@ static po_message_t find_message( po_file_t po, const char *msgid, const char *m
return
msg
;
}
static
const
char
*
get_msgstr
(
po_file_t
po
,
const
char
*
msgid
,
const
char
*
context
,
int
*
found
)
static
const
char
*
get_msgstr
(
const
char
*
msgid
,
const
char
*
context
,
int
*
found
)
{
const
char
*
ret
=
msgid
;
po_message_t
msg
;
po_message_iterator_t
iterator
;
msg
=
find_message
(
po
,
msgid
,
context
,
&
iterator
);
msg
=
find_message
(
po
_file
,
msgid
,
context
,
&
iterator
);
if
(
msg
&&
!
po_message_is_fuzzy
(
msg
))
{
ret
=
po_message_msgstr
(
msg
);
...
...
@@ -491,13 +490,16 @@ static const char *get_msgstr( po_file_t po, const char *msgid, const char *cont
return
ret
;
}
static
po_file_t
re
ad_po_file
(
const
char
*
name
)
static
void
lo
ad_po_file
(
const
char
*
name
)
{
po_file_t
po
;
if
(
!
(
po
=
po_file_read
(
name
,
&
po_xerror_handler
)))
if
(
!
(
po_file
=
po_file_read
(
name
,
&
po_xerror_handler
)))
error
(
"cannot load po file '%s'
\n
"
,
name
);
return
po
;
}
static
void
free_po_file
(
void
)
{
po_file_free
(
po_file
);
po_file
=
NULL
;
}
static
void
add_po_string
(
po_file_t
po
,
const
string_t
*
msgid
,
const
string_t
*
msgstr
,
...
...
@@ -818,7 +820,7 @@ void write_po_files( const char *outname )
#endif
/* HAVE_LIBGETTEXTPO */
static
string_t
*
translate_string
(
po_file_t
po
,
string_t
*
str
,
int
*
found
)
static
string_t
*
translate_string
(
string_t
*
str
,
int
*
found
)
{
string_t
*
new
;
const
char
*
transl
;
...
...
@@ -830,7 +832,7 @@ static string_t *translate_string( po_file_t po, string_t *str, int *found )
msgid
=
buffer
;
context
=
get_message_context
(
&
msgid
);
transl
=
get_msgstr
(
po
,
msgid
,
context
,
found
);
transl
=
get_msgstr
(
msgid
,
context
,
found
);
new
=
xmalloc
(
sizeof
(
*
new
)
);
new
->
type
=
str_unicode
;
...
...
@@ -844,7 +846,7 @@ static string_t *translate_string( po_file_t po, string_t *str, int *found )
return
new
;
}
static
control_t
*
translate_controls
(
po_file_t
po
,
control_t
*
ctrl
,
int
*
found
)
static
control_t
*
translate_controls
(
control_t
*
ctrl
,
int
*
found
)
{
control_t
*
new
,
*
head
=
NULL
,
*
tail
=
NULL
;
...
...
@@ -856,7 +858,7 @@ static control_t *translate_controls( po_file_t po, control_t *ctrl, int *found
{
new
->
title
=
new_name_id
();
*
new
->
title
=
*
ctrl
->
title
;
new
->
title
->
name
.
s_name
=
translate_string
(
po
,
ctrl
->
title
->
name
.
s_name
,
found
);
new
->
title
->
name
.
s_name
=
translate_string
(
ctrl
->
title
->
name
.
s_name
,
found
);
}
else
new
->
title
=
dup_name_id
(
ctrl
->
title
);
new
->
ctlclass
=
dup_name_id
(
ctrl
->
ctlclass
);
...
...
@@ -870,7 +872,7 @@ static control_t *translate_controls( po_file_t po, control_t *ctrl, int *found
return
head
;
}
static
menu_item_t
*
translate_items
(
po_file_t
po
,
menu_item_t
*
item
,
int
*
found
)
static
menu_item_t
*
translate_items
(
menu_item_t
*
item
,
int
*
found
)
{
menu_item_t
*
new
,
*
head
=
NULL
,
*
tail
=
NULL
;
...
...
@@ -878,8 +880,8 @@ static menu_item_t *translate_items( po_file_t po, menu_item_t *item, int *found
{
new
=
xmalloc
(
sizeof
(
*
new
)
);
*
new
=
*
item
;
if
(
item
->
name
)
new
->
name
=
translate_string
(
po
,
item
->
name
,
found
);
if
(
item
->
popup
)
new
->
popup
=
translate_items
(
po
,
item
->
popup
,
found
);
if
(
item
->
name
)
new
->
name
=
translate_string
(
item
->
name
,
found
);
if
(
item
->
popup
)
new
->
popup
=
translate_items
(
item
->
popup
,
found
);
if
(
tail
)
tail
->
next
=
new
;
else
head
=
new
;
new
->
next
=
NULL
;
...
...
@@ -890,8 +892,7 @@ static menu_item_t *translate_items( po_file_t po, menu_item_t *item, int *found
return
head
;
}
static
stringtable_t
*
translate_stringtable
(
po_file_t
po
,
stringtable_t
*
stt
,
language_t
*
lang
,
int
*
found
)
static
stringtable_t
*
translate_stringtable
(
stringtable_t
*
stt
,
language_t
*
lang
,
int
*
found
)
{
stringtable_t
*
new
,
*
head
=
NULL
,
*
tail
=
NULL
;
int
i
;
...
...
@@ -906,7 +907,7 @@ static stringtable_t *translate_stringtable( po_file_t po, stringtable_t *stt,
memcpy
(
new
->
entries
,
stt
->
entries
,
new
->
nentries
*
sizeof
(
*
new
->
entries
)
);
for
(
i
=
0
;
i
<
stt
->
nentries
;
i
++
)
if
(
stt
->
entries
[
i
].
str
)
new
->
entries
[
i
].
str
=
translate_string
(
po
,
stt
->
entries
[
i
].
str
,
found
);
new
->
entries
[
i
].
str
=
translate_string
(
stt
->
entries
[
i
].
str
,
found
);
if
(
tail
)
tail
->
next
=
new
;
else
head
=
new
;
...
...
@@ -918,19 +919,19 @@ static stringtable_t *translate_stringtable( po_file_t po, stringtable_t *stt,
return
head
;
}
static
void
translate_dialog
(
po_file_t
po
,
dialog_t
*
dlg
,
dialog_t
*
new
,
int
*
found
)
static
void
translate_dialog
(
dialog_t
*
dlg
,
dialog_t
*
new
,
int
*
found
)
{
if
(
dlg
->
title
)
new
->
title
=
translate_string
(
po
,
dlg
->
title
,
found
);
if
(
dlg
->
title
)
new
->
title
=
translate_string
(
dlg
->
title
,
found
);
if
(
dlg
->
font
)
{
new
->
font
=
xmalloc
(
sizeof
(
*
dlg
->
font
)
);
new
->
font
=
dlg
->
font
;
new
->
font
->
name
=
translate_string
(
po
,
dlg
->
font
->
name
,
found
);
new
->
font
->
name
=
translate_string
(
dlg
->
font
->
name
,
found
);
}
new
->
controls
=
translate_controls
(
po
,
dlg
->
controls
,
found
);
new
->
controls
=
translate_controls
(
dlg
->
controls
,
found
);
}
static
void
translate_resources
(
po_file_t
po
,
language_t
*
lang
)
static
void
translate_resources
(
language_t
*
lang
)
{
resource_t
*
res
;
...
...
@@ -948,15 +949,15 @@ static void translate_resources( po_file_t po, language_t *lang )
break
;
case
res_dlg
:
new
=
dup_resource
(
res
,
lang
);
translate_dialog
(
po
,
res
->
res
.
dlg
,
new
->
res
.
dlg
,
&
found
);
translate_dialog
(
res
->
res
.
dlg
,
new
->
res
.
dlg
,
&
found
);
break
;
case
res_men
:
new
=
dup_resource
(
res
,
lang
);
new
->
res
.
men
->
items
=
translate_items
(
po
,
res
->
res
.
men
->
items
,
&
found
);
new
->
res
.
men
->
items
=
translate_items
(
res
->
res
.
men
->
items
,
&
found
);
break
;
case
res_stt
:
new
=
dup_resource
(
res
,
lang
);
new
->
res
.
stt
=
translate_stringtable
(
po
,
res
->
res
.
stt
,
lang
,
&
found
);
new
->
res
.
stt
=
translate_stringtable
(
res
->
res
.
stt
,
lang
,
&
found
);
break
;
case
res_msg
:
/* FIXME */
...
...
@@ -978,7 +979,6 @@ static void translate_resources( po_file_t po, language_t *lang )
void
add_translations
(
const
char
*
po_dir
)
{
resource_t
*
res
;
po_file_t
po
;
char
buffer
[
256
];
char
*
p
,
*
tok
,
*
name
;
unsigned
int
i
;
...
...
@@ -1009,9 +1009,9 @@ void add_translations( const char *po_dir )
error
(
"unknown language '%s'
\n
"
,
tok
);
name
=
strmake
(
"%s/%s.po"
,
po_dir
,
tok
);
po
=
re
ad_po_file
(
name
);
translate_resources
(
po
,
new_language
(
languages
[
i
].
id
,
languages
[
i
].
sub
)
);
po_file
_free
(
po
);
lo
ad_po_file
(
name
);
translate_resources
(
new_language
(
languages
[
i
].
id
,
languages
[
i
].
sub
)
);
free_
po_file
(
);
free
(
name
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment