Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c44eb6d6
Commit
c44eb6d6
authored
Nov 15, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmc: Add support for named locales.
parent
4e89a259
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
179 additions
and
329 deletions
+179
-329
makedep.c
tools/makedep.c
+1
-0
po.c
tools/wmc/po.c
+76
-318
utils.c
tools/wmc/utils.c
+101
-11
utils.h
tools/wmc/utils.h
+1
-0
No files found.
tools/makedep.c
View file @
c44eb6d6
...
...
@@ -2781,6 +2781,7 @@ static void output_source_mc( struct makefile *make, struct incl_file *source, c
output
(
"%s.pot %s.res: %s"
,
obj_path
,
obj_path
,
source
->
filename
);
output_filename
(
tools_path
(
make
,
"wmc"
));
output_filenames
(
source
->
dependencies
);
if
(
make
->
src_dir
)
output_filename
(
"nls/locale.nls"
);
output
(
"
\n
"
);
output
(
"
\t
%s%s -u -o $@ %s"
,
cmd_prefix
(
"WMC"
),
tools_path
(
make
,
"wmc"
),
source
->
filename
);
if
(
linguas
.
count
)
...
...
tools/wmc/po.c
View file @
c44eb6d6
...
...
@@ -48,318 +48,6 @@ struct mo_file
static
struct
lan_blk
*
new_top
,
*
new_tail
;
static
const
struct
{
unsigned
int
id
,
sub
;
const
char
*
name
;
}
languages
[]
=
{
{
LANG_AFRIKAANS
,
SUBLANG_NEUTRAL
,
"af"
},
{
LANG_AFRIKAANS
,
SUBLANG_AFRIKAANS_SOUTH_AFRICA
,
"af_ZA"
},
{
LANG_ALBANIAN
,
SUBLANG_NEUTRAL
,
"sq"
},
{
LANG_ALBANIAN
,
SUBLANG_ALBANIAN_ALBANIA
,
"sq_AL"
},
{
LANG_AMHARIC
,
SUBLANG_NEUTRAL
,
"am"
},
{
LANG_AMHARIC
,
SUBLANG_AMHARIC_ETHIOPIA
,
"am_ET"
},
{
LANG_ARABIC
,
SUBLANG_NEUTRAL
,
"ar"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_SAUDI_ARABIA
,
"ar_SA"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_IRAQ
,
"ar_IQ"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_EGYPT
,
"ar_EG"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_LIBYA
,
"ar_LY"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_ALGERIA
,
"ar_DZ"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_MOROCCO
,
"ar_MA"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_TUNISIA
,
"ar_TN"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_OMAN
,
"ar_OM"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_YEMEN
,
"ar_YE"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_SYRIA
,
"ar_SY"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_JORDAN
,
"ar_JO"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_LEBANON
,
"ar_LB"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_KUWAIT
,
"ar_KW"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_UAE
,
"ar_AE"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_BAHRAIN
,
"ar_BH"
},
{
LANG_ARABIC
,
SUBLANG_ARABIC_QATAR
,
"ar_QA"
},
{
LANG_ARMENIAN
,
SUBLANG_NEUTRAL
,
"hy"
},
{
LANG_ARMENIAN
,
SUBLANG_ARMENIAN_ARMENIA
,
"hy_AM"
},
{
LANG_ASSAMESE
,
SUBLANG_NEUTRAL
,
"as"
},
{
LANG_ASSAMESE
,
SUBLANG_ASSAMESE_INDIA
,
"as_IN"
},
{
LANG_ASTURIAN
,
SUBLANG_NEUTRAL
,
"ast"
},
{
LANG_ASTURIAN
,
SUBLANG_DEFAULT
,
"ast_ES"
},
{
LANG_AZERBAIJANI
,
SUBLANG_NEUTRAL
,
"az"
},
{
LANG_AZERBAIJANI
,
SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN
,
"az_AZ@latin"
},
{
LANG_AZERBAIJANI
,
SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC
,
"az_AZ@cyrillic"
},
{
LANG_BASQUE
,
SUBLANG_NEUTRAL
,
"eu"
},
{
LANG_BASQUE
,
SUBLANG_BASQUE_BASQUE
,
"eu_ES"
},
{
LANG_BELARUSIAN
,
SUBLANG_NEUTRAL
,
"be"
},
{
LANG_BELARUSIAN
,
SUBLANG_BELARUSIAN_BELARUS
,
"be_BY"
},
{
LANG_BENGALI
,
SUBLANG_NEUTRAL
,
"bn"
},
{
LANG_BENGALI
,
SUBLANG_BENGALI_INDIA
,
"bn_IN"
},
{
LANG_BENGALI
,
SUBLANG_BENGALI_BANGLADESH
,
"bn_BD"
},
{
LANG_BRETON
,
SUBLANG_NEUTRAL
,
"br"
},
{
LANG_BRETON
,
SUBLANG_BRETON_FRANCE
,
"br_FR"
},
{
LANG_BULGARIAN
,
SUBLANG_NEUTRAL
,
"bg"
},
{
LANG_BULGARIAN
,
SUBLANG_BULGARIAN_BULGARIA
,
"bg_BG"
},
{
LANG_CATALAN
,
SUBLANG_NEUTRAL
,
"ca"
},
{
LANG_CATALAN
,
SUBLANG_CATALAN_CATALAN
,
"ca_ES"
},
{
LANG_CHINESE
,
SUBLANG_NEUTRAL
,
"zh"
},
{
LANG_CHINESE
,
SUBLANG_CHINESE_TRADITIONAL
,
"zh_TW"
},
{
LANG_CHINESE
,
SUBLANG_CHINESE_SIMPLIFIED
,
"zh_CN"
},
{
LANG_CHINESE
,
SUBLANG_CHINESE_HONGKONG
,
"zh_HK"
},
{
LANG_CHINESE
,
SUBLANG_CHINESE_SINGAPORE
,
"zh_SG"
},
{
LANG_CHINESE
,
SUBLANG_CHINESE_MACAU
,
"zh_MO"
},
{
LANG_CZECH
,
SUBLANG_NEUTRAL
,
"cs"
},
{
LANG_CZECH
,
SUBLANG_CZECH_CZECH_REPUBLIC
,
"cs_CZ"
},
{
LANG_DANISH
,
SUBLANG_NEUTRAL
,
"da"
},
{
LANG_DANISH
,
SUBLANG_DANISH_DENMARK
,
"da_DK"
},
{
LANG_DIVEHI
,
SUBLANG_NEUTRAL
,
"dv"
},
{
LANG_DIVEHI
,
SUBLANG_DIVEHI_MALDIVES
,
"dv_MV"
},
{
LANG_DUTCH
,
SUBLANG_NEUTRAL
,
"nl"
},
{
LANG_DUTCH
,
SUBLANG_DUTCH
,
"nl_NL"
},
{
LANG_DUTCH
,
SUBLANG_DUTCH_BELGIAN
,
"nl_BE"
},
{
LANG_DUTCH
,
SUBLANG_DUTCH_SURINAM
,
"nl_SR"
},
{
LANG_ENGLISH
,
SUBLANG_NEUTRAL
,
"en"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
,
"en_US"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_UK
,
"en_GB"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_AUS
,
"en_AU"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_CAN
,
"en_CA"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_NZ
,
"en_NZ"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_EIRE
,
"en_IE"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_SOUTH_AFRICA
,
"en_ZA"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_JAMAICA
,
"en_JM"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_CARIBBEAN
,
"en_CB"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_BELIZE
,
"en_BZ"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_TRINIDAD
,
"en_TT"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_ZIMBABWE
,
"en_ZW"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_PHILIPPINES
,
"en_PH"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_INDIA
,
"en_IN"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_MALAYSIA
,
"en_MY"
},
{
LANG_ENGLISH
,
SUBLANG_ENGLISH_SINGAPORE
,
"en_SG"
},
{
LANG_ESTONIAN
,
SUBLANG_NEUTRAL
,
"et"
},
{
LANG_ESTONIAN
,
SUBLANG_ESTONIAN_ESTONIA
,
"et_EE"
},
{
LANG_FAEROESE
,
SUBLANG_NEUTRAL
,
"fo"
},
{
LANG_FAEROESE
,
SUBLANG_FAEROESE_FAROE_ISLANDS
,
"fo_FO"
},
{
LANG_FILIPINO
,
SUBLANG_NEUTRAL
,
"fil"
},
{
LANG_FILIPINO
,
SUBLANG_FILIPINO_PHILIPPINES
,
"fil_PH"
},
{
LANG_FINNISH
,
SUBLANG_NEUTRAL
,
"fi"
},
{
LANG_FINNISH
,
SUBLANG_FINNISH_FINLAND
,
"fi_FI"
},
{
LANG_FRENCH
,
SUBLANG_NEUTRAL
,
"fr"
},
{
LANG_FRENCH
,
SUBLANG_FRENCH
,
"fr_FR"
},
{
LANG_FRENCH
,
SUBLANG_FRENCH_BELGIAN
,
"fr_BE"
},
{
LANG_FRENCH
,
SUBLANG_FRENCH_CANADIAN
,
"fr_CA"
},
{
LANG_FRENCH
,
SUBLANG_FRENCH_SWISS
,
"fr_CH"
},
{
LANG_FRENCH
,
SUBLANG_FRENCH_LUXEMBOURG
,
"fr_LU"
},
{
LANG_FRENCH
,
SUBLANG_FRENCH_MONACO
,
"fr_MC"
},
{
LANG_GALICIAN
,
SUBLANG_NEUTRAL
,
"gl"
},
{
LANG_GALICIAN
,
SUBLANG_GALICIAN_GALICIAN
,
"gl_ES"
},
{
LANG_GEORGIAN
,
SUBLANG_NEUTRAL
,
"ka"
},
{
LANG_GEORGIAN
,
SUBLANG_GEORGIAN_GEORGIA
,
"ka_GE"
},
{
LANG_GERMAN
,
SUBLANG_NEUTRAL
,
"de"
},
{
LANG_GERMAN
,
SUBLANG_GERMAN
,
"de_DE"
},
{
LANG_GERMAN
,
SUBLANG_GERMAN_SWISS
,
"de_CH"
},
{
LANG_GERMAN
,
SUBLANG_GERMAN_AUSTRIAN
,
"de_AT"
},
{
LANG_GERMAN
,
SUBLANG_GERMAN_LUXEMBOURG
,
"de_LU"
},
{
LANG_GERMAN
,
SUBLANG_GERMAN_LIECHTENSTEIN
,
"de_LI"
},
{
LANG_GREEK
,
SUBLANG_NEUTRAL
,
"el"
},
{
LANG_GREEK
,
SUBLANG_GREEK_GREECE
,
"el_GR"
},
{
LANG_GUJARATI
,
SUBLANG_NEUTRAL
,
"gu"
},
{
LANG_GUJARATI
,
SUBLANG_GUJARATI_INDIA
,
"gu_IN"
},
{
LANG_HAUSA
,
SUBLANG_NEUTRAL
,
"ha"
},
{
LANG_HAUSA
,
SUBLANG_HAUSA_NIGERIA
,
"ha_NG"
},
{
LANG_HAWAIIAN
,
SUBLANG_NEUTRAL
,
"haw"
},
{
LANG_HAWAIIAN
,
SUBLANG_HAWAIIAN_US
,
"haw_US"
},
{
LANG_HEBREW
,
SUBLANG_NEUTRAL
,
"he"
},
{
LANG_HEBREW
,
SUBLANG_HEBREW_ISRAEL
,
"he_IL"
},
{
LANG_HINDI
,
SUBLANG_NEUTRAL
,
"hi"
},
{
LANG_HINDI
,
SUBLANG_HINDI_INDIA
,
"hi_IN"
},
{
LANG_HUNGARIAN
,
SUBLANG_NEUTRAL
,
"hu"
},
{
LANG_HUNGARIAN
,
SUBLANG_HUNGARIAN_HUNGARY
,
"hu_HU"
},
{
LANG_ICELANDIC
,
SUBLANG_NEUTRAL
,
"is"
},
{
LANG_ICELANDIC
,
SUBLANG_ICELANDIC_ICELAND
,
"is_IS"
},
{
LANG_IGBO
,
SUBLANG_NEUTRAL
,
"ig"
},
{
LANG_IGBO
,
SUBLANG_IGBO_NIGERIA
,
"ig_NG"
},
{
LANG_INDONESIAN
,
SUBLANG_NEUTRAL
,
"id"
},
{
LANG_INDONESIAN
,
SUBLANG_INDONESIAN_INDONESIA
,
"id_ID"
},
{
LANG_INUKTITUT
,
SUBLANG_NEUTRAL
,
"iu"
},
{
LANG_INUKTITUT
,
SUBLANG_INUKTITUT_CANADA
,
"iu_CA"
},
{
LANG_IRISH
,
SUBLANG_NEUTRAL
,
"ga"
},
{
LANG_IRISH
,
SUBLANG_IRISH_IRELAND
,
"ga_IE"
},
{
LANG_ITALIAN
,
SUBLANG_NEUTRAL
,
"it"
},
{
LANG_ITALIAN
,
SUBLANG_ITALIAN
,
"it_IT"
},
{
LANG_ITALIAN
,
SUBLANG_ITALIAN_SWISS
,
"it_CH"
},
{
LANG_JAPANESE
,
SUBLANG_NEUTRAL
,
"ja"
},
{
LANG_JAPANESE
,
SUBLANG_JAPANESE_JAPAN
,
"ja_JP"
},
{
LANG_KANNADA
,
SUBLANG_NEUTRAL
,
"kn"
},
{
LANG_KANNADA
,
SUBLANG_KANNADA_INDIA
,
"kn_IN"
},
{
LANG_KAZAK
,
SUBLANG_NEUTRAL
,
"kk"
},
{
LANG_KAZAK
,
SUBLANG_KAZAK_KAZAKHSTAN
,
"kk_KZ"
},
{
LANG_KHMER
,
SUBLANG_NEUTRAL
,
"km"
},
{
LANG_KHMER
,
SUBLANG_KHMER_CAMBODIA
,
"km_KH"
},
{
LANG_KINYARWANDA
,
SUBLANG_NEUTRAL
,
"rw"
},
{
LANG_KINYARWANDA
,
SUBLANG_KINYARWANDA_RWANDA
,
"rw_RW"
},
{
LANG_KONKANI
,
SUBLANG_NEUTRAL
,
"kok"
},
{
LANG_KONKANI
,
SUBLANG_KONKANI_INDIA
,
"kok_IN"
},
{
LANG_KOREAN
,
SUBLANG_NEUTRAL
,
"ko"
},
{
LANG_KOREAN
,
SUBLANG_KOREAN
,
"ko_KR"
},
{
LANG_KYRGYZ
,
SUBLANG_NEUTRAL
,
"ky"
},
{
LANG_KYRGYZ
,
SUBLANG_KYRGYZ_KYRGYZSTAN
,
"ky_KG"
},
{
LANG_LAO
,
SUBLANG_NEUTRAL
,
"lo"
},
{
LANG_LAO
,
SUBLANG_LAO_LAO
,
"lo_LA"
},
{
LANG_LATVIAN
,
SUBLANG_NEUTRAL
,
"lv"
},
{
LANG_LATVIAN
,
SUBLANG_LATVIAN_LATVIA
,
"lv_LV"
},
{
LANG_LITHUANIAN
,
SUBLANG_NEUTRAL
,
"lt"
},
{
LANG_LITHUANIAN
,
SUBLANG_LITHUANIAN
,
"lt_LT"
},
{
LANG_MACEDONIAN
,
SUBLANG_NEUTRAL
,
"mk"
},
{
LANG_MACEDONIAN
,
SUBLANG_MACEDONIAN_MACEDONIA
,
"mk_MK"
},
{
LANG_MALAY
,
SUBLANG_NEUTRAL
,
"ms"
},
{
LANG_MALAY
,
SUBLANG_MALAY_MALAYSIA
,
"ms_MY"
},
{
LANG_MALAY
,
SUBLANG_MALAY_BRUNEI_DARUSSALAM
,
"ms_BN"
},
{
LANG_MALAYALAM
,
SUBLANG_NEUTRAL
,
"ml"
},
{
LANG_MALAYALAM
,
SUBLANG_MALAYALAM_INDIA
,
"ml_IN"
},
{
LANG_MALTESE
,
SUBLANG_NEUTRAL
,
"mt"
},
{
LANG_MALTESE
,
SUBLANG_MALTESE_MALTA
,
"mt_MT"
},
{
LANG_MARATHI
,
SUBLANG_NEUTRAL
,
"mr"
},
{
LANG_MARATHI
,
SUBLANG_MARATHI_INDIA
,
"mr_IN"
},
{
LANG_MONGOLIAN
,
SUBLANG_NEUTRAL
,
"mn"
},
{
LANG_MONGOLIAN
,
SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA
,
"mn_MN"
},
{
LANG_MONGOLIAN
,
SUBLANG_MONGOLIAN_PRC
,
"mn_CN"
},
{
LANG_NEPALI
,
SUBLANG_NEUTRAL
,
"ne"
},
{
LANG_NEPALI
,
SUBLANG_NEPALI_NEPAL
,
"ne_NP"
},
{
LANG_NEPALI
,
SUBLANG_NEPALI_INDIA
,
"ne_IN"
},
{
LANG_NORWEGIAN
,
SUBLANG_NORWEGIAN_BOKMAL
,
"nb_NO"
},
{
LANG_NORWEGIAN
,
SUBLANG_NORWEGIAN_NYNORSK
,
"nn_NO"
},
{
LANG_ODIA
,
SUBLANG_NEUTRAL
,
"or"
},
{
LANG_ODIA
,
SUBLANG_ODIA_INDIA
,
"or_IN"
},
{
LANG_PASHTO
,
SUBLANG_NEUTRAL
,
"ps"
},
{
LANG_PASHTO
,
SUBLANG_PASHTO_AFGHANISTAN
,
"ps_AF"
},
{
LANG_PERSIAN
,
SUBLANG_NEUTRAL
,
"fa"
},
{
LANG_PERSIAN
,
SUBLANG_PERSIAN_IRAN
,
"fa_IR"
},
{
LANG_POLISH
,
SUBLANG_NEUTRAL
,
"pl"
},
{
LANG_POLISH
,
SUBLANG_POLISH_POLAND
,
"pl_PL"
},
{
LANG_PORTUGUESE
,
SUBLANG_NEUTRAL
,
"pt"
},
{
LANG_PORTUGUESE
,
SUBLANG_PORTUGUESE_BRAZILIAN
,
"pt_BR"
},
{
LANG_PORTUGUESE
,
SUBLANG_PORTUGUESE_PORTUGAL
,
"pt_PT"
},
{
LANG_PUNJABI
,
SUBLANG_NEUTRAL
,
"pa"
},
{
LANG_PUNJABI
,
SUBLANG_PUNJABI_INDIA
,
"pa_IN"
},
{
LANG_PUNJABI
,
SUBLANG_PUNJABI_PAKISTAN
,
"pa_PK"
},
{
LANG_ROMANIAN
,
SUBLANG_NEUTRAL
,
"ro"
},
{
LANG_ROMANIAN
,
SUBLANG_ROMANIAN_ROMANIA
,
"ro_RO"
},
{
LANG_ROMANSH
,
SUBLANG_NEUTRAL
,
"rm"
},
{
LANG_ROMANSH
,
SUBLANG_ROMANSH_SWITZERLAND
,
"rm_CH"
},
{
LANG_RUSSIAN
,
SUBLANG_NEUTRAL
,
"ru"
},
{
LANG_RUSSIAN
,
SUBLANG_RUSSIAN_RUSSIA
,
"ru_RU"
},
{
LANG_SAMI
,
SUBLANG_NEUTRAL
,
"se"
},
{
LANG_SAMI
,
SUBLANG_SAMI_NORTHERN_NORWAY
,
"se_NO"
},
{
LANG_SAMI
,
SUBLANG_SAMI_NORTHERN_SWEDEN
,
"se_SE"
},
{
LANG_SAMI
,
SUBLANG_SAMI_NORTHERN_FINLAND
,
"se_FI"
},
{
LANG_SANSKRIT
,
SUBLANG_NEUTRAL
,
"sa"
},
{
LANG_SANSKRIT
,
SUBLANG_SANSKRIT_INDIA
,
"sa_IN"
},
{
LANG_SCOTTISH_GAELIC
,
SUBLANG_NEUTRAL
,
"gd"
},
{
LANG_SCOTTISH_GAELIC
,
SUBLANG_SCOTTISH_GAELIC
,
"gd_GB"
},
/* LANG_SERBIAN/LANG_CROATIAN/LANG_BOSNIAN are the same */
{
LANG_SERBIAN
,
SUBLANG_NEUTRAL
,
"hr"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_CROATIA
,
"hr_HR"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_LATIN
,
"sr_RS@latin"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_CYRILLIC
,
"sr_RS@cyrillic"
},
{
LANG_SERBIAN
,
SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN
,
"hr_BA@latin"
},
{
LANG_SERBIAN
,
SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN
,
"bs_BA@latin"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN
,
"sr_BA@latin"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC
,
"sr_BA@cyrillic"
},
{
LANG_SERBIAN
,
SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC
,
"bs_BA@cyrillic"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_SERBIA_LATIN
,
"sr_RS@latin"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_SERBIA_CYRILLIC
,
"sr_RS@cyrillic"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_MONTENEGRO_LATIN
,
"sr_ME@latin"
},
{
LANG_SERBIAN
,
SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC
,
"sr_ME@cyrillic"
},
{
LANG_SINHALESE
,
SUBLANG_NEUTRAL
,
"si"
},
{
LANG_SINHALESE
,
SUBLANG_SINHALESE_SRI_LANKA
,
"si_LK"
},
{
LANG_SLOVAK
,
SUBLANG_NEUTRAL
,
"sk"
},
{
LANG_SLOVAK
,
SUBLANG_SLOVAK_SLOVAKIA
,
"sk_SK"
},
{
LANG_SLOVENIAN
,
SUBLANG_NEUTRAL
,
"sl"
},
{
LANG_SLOVENIAN
,
SUBLANG_SLOVENIAN_SLOVENIA
,
"sl_SI"
},
{
LANG_SOTHO
,
SUBLANG_NEUTRAL
,
"nso"
},
{
LANG_SOTHO
,
SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA
,
"nso_ZA"
},
{
LANG_SPANISH
,
SUBLANG_NEUTRAL
,
"es"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH
,
"es_ES"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_MEXICAN
,
"es_MX"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_MODERN
,
"es_ES_modern"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_GUATEMALA
,
"es_GT"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_COSTA_RICA
,
"es_CR"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_PANAMA
,
"es_PA"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_DOMINICAN_REPUBLIC
,
"es_DO"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_VENEZUELA
,
"es_VE"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_COLOMBIA
,
"es_CO"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_PERU
,
"es_PE"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_ARGENTINA
,
"es_AR"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_ECUADOR
,
"es_EC"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_CHILE
,
"es_CL"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_URUGUAY
,
"es_UY"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_PARAGUAY
,
"es_PY"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_BOLIVIA
,
"es_BO"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_EL_SALVADOR
,
"es_SV"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_HONDURAS
,
"es_HN"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_NICARAGUA
,
"es_NI"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_PUERTO_RICO
,
"es_PR"
},
{
LANG_SPANISH
,
SUBLANG_SPANISH_US
,
"es_US"
},
{
LANG_SWAHILI
,
SUBLANG_NEUTRAL
,
"sw"
},
{
LANG_SWAHILI
,
SUBLANG_SWAHILI_KENYA
,
"sw_KE"
},
{
LANG_SWEDISH
,
SUBLANG_NEUTRAL
,
"sv"
},
{
LANG_SWEDISH
,
SUBLANG_SWEDISH_SWEDEN
,
"sv_SE"
},
{
LANG_SWEDISH
,
SUBLANG_SWEDISH_FINLAND
,
"sv_FI"
},
{
LANG_SYRIAC
,
SUBLANG_NEUTRAL
,
"syr"
},
{
LANG_SYRIAC
,
SUBLANG_SYRIAC_SYRIA
,
"syr_SY"
},
{
LANG_TAJIK
,
SUBLANG_NEUTRAL
,
"tg"
},
{
LANG_TAJIK
,
SUBLANG_TAJIK_TAJIKISTAN
,
"tg_TJ"
},
{
LANG_TAMIL
,
SUBLANG_NEUTRAL
,
"ta"
},
{
LANG_TAMIL
,
SUBLANG_TAMIL_INDIA
,
"ta_IN"
},
{
LANG_TATAR
,
SUBLANG_NEUTRAL
,
"tt"
},
{
LANG_TATAR
,
SUBLANG_TATAR_RUSSIA
,
"tt_TA"
},
{
LANG_TELUGU
,
SUBLANG_NEUTRAL
,
"te"
},
{
LANG_TELUGU
,
SUBLANG_TELUGU_INDIA
,
"te_IN"
},
{
LANG_THAI
,
SUBLANG_NEUTRAL
,
"th"
},
{
LANG_THAI
,
SUBLANG_THAI_THAILAND
,
"th_TH"
},
{
LANG_TIGRINYA
,
SUBLANG_NEUTRAL
,
"ti"
},
{
LANG_TIGRINYA
,
SUBLANG_TIGRINYA_ETHIOPIA
,
"ti_ET"
},
{
LANG_TIGRINYA
,
SUBLANG_TIGRINYA_ERITREA
,
"ti_ER"
},
{
LANG_TSWANA
,
SUBLANG_NEUTRAL
,
"tn"
},
{
LANG_TSWANA
,
SUBLANG_TSWANA_SOUTH_AFRICA
,
"tn_ZA"
},
{
LANG_TURKISH
,
SUBLANG_NEUTRAL
,
"tr"
},
{
LANG_TURKISH
,
SUBLANG_TURKISH_TURKEY
,
"tr_TR"
},
{
LANG_UIGHUR
,
SUBLANG_NEUTRAL
,
"ug"
},
{
LANG_UIGHUR
,
SUBLANG_UIGHUR_PRC
,
"ug_CN"
},
{
LANG_UKRAINIAN
,
SUBLANG_NEUTRAL
,
"uk"
},
{
LANG_UKRAINIAN
,
SUBLANG_UKRAINIAN_UKRAINE
,
"uk_UA"
},
{
LANG_URDU
,
SUBLANG_NEUTRAL
,
"ur"
},
{
LANG_URDU
,
SUBLANG_URDU_PAKISTAN
,
"ur_PK"
},
{
LANG_URDU
,
SUBLANG_URDU_INDIA
,
"ur_IN"
},
{
LANG_UZBEK
,
SUBLANG_NEUTRAL
,
"uz"
},
{
LANG_UZBEK
,
SUBLANG_UZBEK_LATIN
,
"uz_UZ@latin"
},
{
LANG_UZBEK
,
SUBLANG_UZBEK_CYRILLIC
,
"uz_UZ@cyrillic"
},
{
LANG_VIETNAMESE
,
SUBLANG_NEUTRAL
,
"vi"
},
{
LANG_VIETNAMESE
,
SUBLANG_VIETNAMESE_VIETNAM
,
"vi_VN"
},
{
LANG_WELSH
,
SUBLANG_NEUTRAL
,
"cy"
},
{
LANG_WELSH
,
SUBLANG_WELSH_UNITED_KINGDOM
,
"cy_GB"
},
{
LANG_WOLOF
,
SUBLANG_NEUTRAL
,
"wo"
},
{
LANG_WOLOF
,
SUBLANG_WOLOF_SENEGAL
,
"wo_SN"
},
{
LANG_XHOSA
,
SUBLANG_NEUTRAL
,
"xh"
},
{
LANG_XHOSA
,
SUBLANG_XHOSA_SOUTH_AFRICA
,
"xh_ZA"
},
{
LANG_YORUBA
,
SUBLANG_NEUTRAL
,
"yo"
},
{
LANG_YORUBA
,
SUBLANG_YORUBA_NIGERIA
,
"yo_NG"
},
{
LANG_ZULU
,
SUBLANG_NEUTRAL
,
"zu"
},
{
LANG_ZULU
,
SUBLANG_ZULU_SOUTH_AFRICA
,
"zu_ZA"
},
#ifdef LANG_ESPERANTO
{
LANG_ESPERANTO
,
SUBLANG_DEFAULT
,
"eo"
},
#endif
#ifdef LANG_WALON
{
LANG_WALON
,
SUBLANG_NEUTRAL
,
"wa"
},
{
LANG_WALON
,
SUBLANG_DEFAULT
,
"wa_BE"
},
#endif
#ifdef LANG_CORNISH
{
LANG_CORNISH
,
SUBLANG_NEUTRAL
,
"kw"
},
{
LANG_CORNISH
,
SUBLANG_DEFAULT
,
"kw_GB"
},
#endif
#ifdef LANG_MANX_GAELIC
{
LANG_MANX_GAELIC
,
SUBLANG_MANX_GAELIC
,
"gv_GB"
},
#endif
};
static
BOOL
is_english
(
int
lan
)
{
return
lan
==
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_DEFAULT
);
...
...
@@ -695,12 +383,80 @@ static void translate_messages( int lang )
}
}
/* Unix format is: lang[_country][.charset][@modifier]
* Windows format is: lang[-script][-country][_modifier] */
static
int
unix_to_win_locale
(
const
char
*
unix_name
,
char
*
win_name
)
{
static
const
char
sep
[]
=
"_.@"
;
const
char
*
extra
=
NULL
;
char
buffer
[
LOCALE_NAME_MAX_LENGTH
];
char
*
p
,
*
country
=
NULL
,
*
modifier
=
NULL
;
if
(
strlen
(
unix_name
)
>=
LOCALE_NAME_MAX_LENGTH
)
return
FALSE
;
strcpy
(
buffer
,
unix_name
);
if
(
!
(
p
=
strpbrk
(
buffer
,
sep
)))
{
strcpy
(
win_name
,
buffer
);
return
TRUE
;
}
if
(
*
p
==
'_'
)
{
*
p
++
=
0
;
country
=
p
;
p
=
strpbrk
(
p
,
sep
+
1
);
}
if
(
p
&&
*
p
==
'.'
)
{
*
p
++
=
0
;
/* charset, ignore */
p
=
strchr
(
p
,
'@'
);
}
if
(
p
)
{
*
p
++
=
0
;
modifier
=
p
;
}
/* rebuild a Windows name */
strcpy
(
win_name
,
buffer
);
if
(
modifier
)
{
if
(
!
strcmp
(
modifier
,
"arabic"
))
strcat
(
win_name
,
"-Arab"
);
else
if
(
!
strcmp
(
modifier
,
"chakma"
))
strcat
(
win_name
,
"-Cakm"
);
else
if
(
!
strcmp
(
modifier
,
"cherokee"
))
strcat
(
win_name
,
"-Cher"
);
else
if
(
!
strcmp
(
modifier
,
"cyrillic"
))
strcat
(
win_name
,
"-Cyrl"
);
else
if
(
!
strcmp
(
modifier
,
"devanagari"
))
strcat
(
win_name
,
"-Deva"
);
else
if
(
!
strcmp
(
modifier
,
"gurmukhi"
))
strcat
(
win_name
,
"-Guru"
);
else
if
(
!
strcmp
(
modifier
,
"javanese"
))
strcat
(
win_name
,
"-Java"
);
else
if
(
!
strcmp
(
modifier
,
"latin"
))
strcat
(
win_name
,
"-Latn"
);
else
if
(
!
strcmp
(
modifier
,
"mongolian"
))
strcat
(
win_name
,
"-Mong"
);
else
if
(
!
strcmp
(
modifier
,
"syriac"
))
strcat
(
win_name
,
"-Syrc"
);
else
if
(
!
strcmp
(
modifier
,
"tifinagh"
))
strcat
(
win_name
,
"-Tfng"
);
else
if
(
!
strcmp
(
modifier
,
"tibetan"
))
strcat
(
win_name
,
"-Tibt"
);
else
if
(
!
strcmp
(
modifier
,
"vai"
))
strcat
(
win_name
,
"-Vaii"
);
else
if
(
!
strcmp
(
modifier
,
"yi"
))
strcat
(
win_name
,
"-Yiii"
);
else
if
(
!
strcmp
(
modifier
,
"saaho"
))
strcpy
(
win_name
,
"ssy"
);
else
if
(
!
strcmp
(
modifier
,
"valencia"
))
extra
=
"-valencia"
;
/* ignore unknown modifiers */
}
if
(
country
)
{
p
=
win_name
+
strlen
(
win_name
);
*
p
++
=
'-'
;
strcpy
(
p
,
country
);
}
if
(
extra
)
strcat
(
win_name
,
extra
);
return
TRUE
;
}
void
add_translations
(
const
char
*
po_dir
)
{
struct
lan_blk
*
lbp
;
char
buffer
[
256
];
char
*
p
,
*
tok
,
*
name
;
unsigned
int
i
;
FILE
*
f
;
/* first check if we have English resources to translate */
...
...
@@ -723,15 +479,17 @@ void add_translations( const char *po_dir )
if
((
p
=
strchr
(
buffer
,
'#'
)))
*
p
=
0
;
for
(
tok
=
strtok
(
buffer
,
"
\t\r\n
"
);
tok
;
tok
=
strtok
(
NULL
,
"
\t\r\n
"
))
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
languages
);
i
++
)
if
(
!
strcmp
(
tok
,
languages
[
i
].
name
))
break
;
char
locale
[
LOCALE_NAME_MAX_LENGTH
];
unsigned
int
lang
;
if
(
i
==
ARRAY_SIZE
(
languages
))
if
(
!
unix_to_win_locale
(
tok
,
locale
)
||
!
(
lang
=
get_language_from_name
(
locale
)))
{
error
(
"unknown language '%s'
\n
"
,
tok
);
continue
;
}
name
=
strmake
(
"%s/%s.mo"
,
po_dir
,
tok
);
load_mo_file
(
name
);
translate_messages
(
MAKELANGID
(
languages
[
i
].
id
,
languages
[
i
].
sub
)
);
translate_messages
(
lang
);
free_mo_file
();
free
(
name
);
}
...
...
tools/wmc/utils.c
View file @
c44eb6d6
...
...
@@ -28,6 +28,7 @@
#include <ctype.h>
#include "wmc.h"
#include "winternl.h"
#include "winnls.h"
#include "utils.h"
...
...
@@ -327,6 +328,14 @@ WCHAR *codepage_to_unicode( int codepage, const char *src, int srclen, int *dstl
return
dst
;
}
unsigned
int
get_language_from_name
(
const
char
*
name
)
{
WCHAR
nameW
[
LOCALE_NAME_MAX_LENGTH
];
MultiByteToWideChar
(
1252
,
0
,
name
,
-
1
,
nameW
,
ARRAY_SIZE
(
nameW
)
);
return
LocaleNameToLCID
(
nameW
,
LOCALE_ALLOW_NEUTRAL_NAMES
);
}
#else
/* _WIN32 */
struct
nls_info
...
...
@@ -354,32 +363,43 @@ static void init_nls_info( struct nls_info *info, unsigned short *ptr )
info
->
dbcs_offsets
=
*
ptr
?
ptr
+
1
:
NULL
;
}
static
const
struct
nls_info
*
get_nls_info
(
unsigned
int
codepag
e
)
static
void
*
load_nls_file
(
const
char
*
nam
e
)
{
unsigned
short
*
data
;
char
*
path
;
unsigned
int
i
;
void
*
data
;
size_t
size
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
nlsinfo
)
&&
nlsinfo
[
i
].
codepage
;
i
++
)
if
(
nlsinfo
[
i
].
codepage
==
codepage
)
return
&
nlsinfo
[
i
];
assert
(
i
<
ARRAY_SIZE
(
nlsinfo
)
);
for
(
i
=
0
;
nlsdirs
[
i
];
i
++
)
{
path
=
strmake
(
"%s/c_%03u.nls"
,
nlsdirs
[
i
],
codepag
e
);
char
*
path
=
strmake
(
"%s/%s"
,
nlsdirs
[
i
],
nam
e
);
if
((
data
=
read_file
(
path
,
&
size
)))
{
free
(
path
);
init_nls_info
(
&
nlsinfo
[
i
],
data
);
return
&
nlsinfo
[
i
];
return
data
;
}
free
(
path
);
}
return
NULL
;
}
static
const
struct
nls_info
*
get_nls_info
(
unsigned
int
codepage
)
{
unsigned
short
*
data
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
nlsinfo
)
&&
nlsinfo
[
i
].
codepage
;
i
++
)
if
(
nlsinfo
[
i
].
codepage
==
codepage
)
return
&
nlsinfo
[
i
];
assert
(
i
<
ARRAY_SIZE
(
nlsinfo
)
);
if
((
data
=
load_nls_file
(
strmake
(
"c_%03u.nls"
,
codepage
))))
{
init_nls_info
(
&
nlsinfo
[
i
],
data
);
return
&
nlsinfo
[
i
];
}
return
NULL
;
}
int
is_valid_codepage
(
int
cp
)
{
return
cp
==
CP_UTF8
||
get_nls_info
(
cp
);
...
...
@@ -427,6 +447,76 @@ WCHAR *codepage_to_unicode( int codepage, const char *src, int srclen, int *dstl
return
dst
;
}
static
const
NLS_LOCALE_LCID_INDEX
*
lcids_index
;
static
const
NLS_LOCALE_HEADER
*
locale_table
;
static
const
NLS_LOCALE_LCNAME_INDEX
*
lcnames_index
;
static
const
WCHAR
*
locale_strings
;
static
void
load_locale_nls
(
void
)
{
struct
{
unsigned
int
ctypes
;
unsigned
int
unknown1
;
unsigned
int
unknown2
;
unsigned
int
unknown3
;
unsigned
int
locales
;
unsigned
int
charmaps
;
unsigned
int
geoids
;
unsigned
int
scripts
;
}
*
header
;
if
(
!
(
header
=
load_nls_file
(
"locale.nls"
)))
error
(
"unable to load locale.nls
\n
"
);
locale_table
=
(
const
NLS_LOCALE_HEADER
*
)((
char
*
)
header
+
header
->
locales
);
lcids_index
=
(
const
NLS_LOCALE_LCID_INDEX
*
)((
char
*
)
locale_table
+
locale_table
->
lcids_offset
);
lcnames_index
=
(
const
NLS_LOCALE_LCNAME_INDEX
*
)((
char
*
)
locale_table
+
locale_table
->
lcnames_offset
);
locale_strings
=
(
const
WCHAR
*
)((
char
*
)
locale_table
+
locale_table
->
strings_offset
);
}
static
int
compare_locale_names
(
const
char
*
n1
,
const
WCHAR
*
n2
)
{
for
(;;)
{
WCHAR
ch1
=
(
unsigned
char
)
*
n1
++
;
WCHAR
ch2
=
*
n2
++
;
if
(
ch1
>=
'a'
&&
ch1
<=
'z'
)
ch1
-=
'a'
-
'A'
;
if
(
ch2
>=
'a'
&&
ch2
<=
'z'
)
ch2
-=
'a'
-
'A'
;
if
(
!
ch1
||
ch1
!=
ch2
)
return
ch1
-
ch2
;
}
}
static
const
NLS_LOCALE_LCNAME_INDEX
*
find_lcname_entry
(
const
char
*
name
)
{
int
min
=
0
,
max
=
locale_table
->
nb_lcnames
-
1
;
if
(
!
name
)
return
NULL
;
while
(
min
<=
max
)
{
int
res
,
pos
=
(
min
+
max
)
/
2
;
const
WCHAR
*
str
=
locale_strings
+
lcnames_index
[
pos
].
name
;
res
=
compare_locale_names
(
name
,
str
+
1
);
if
(
res
<
0
)
max
=
pos
-
1
;
else
if
(
res
>
0
)
min
=
pos
+
1
;
else
return
&
lcnames_index
[
pos
];
}
return
NULL
;
}
static
const
NLS_LOCALE_DATA
*
get_locale_data
(
UINT
idx
)
{
ULONG
offset
=
locale_table
->
locales_offset
+
idx
*
locale_table
->
locale_size
;
return
(
const
NLS_LOCALE_DATA
*
)((
const
char
*
)
locale_table
+
offset
);
}
unsigned
int
get_language_from_name
(
const
char
*
name
)
{
const
NLS_LOCALE_LCNAME_INDEX
*
entry
;
if
(
!
locale_table
)
load_locale_nls
();
if
(
!
(
entry
=
find_lcname_entry
(
name
)))
return
0
;
return
get_locale_data
(
entry
->
idx
)
->
unique_lcid
;
}
#endif
/* _WIN32 */
unsigned
char
*
output_buffer
;
...
...
tools/wmc/utils.h
View file @
c44eb6d6
...
...
@@ -40,5 +40,6 @@ WCHAR *utf8_to_unicode( const char *src, int srclen, int *dstlen );
char
*
unicode_to_utf8
(
const
WCHAR
*
src
,
int
srclen
,
int
*
dstlen
);
int
is_valid_codepage
(
int
id
);
WCHAR
*
codepage_to_unicode
(
int
codepage
,
const
char
*
src
,
int
srclen
,
int
*
dstlen
);
unsigned
int
get_language_from_name
(
const
char
*
name
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment