1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-19 15:11:23 +01:00

Rewrite "Interface preferences displays self-names of languages" ...

See original attempt at commit 7ec5fd79df

This eliminates the need for a resource file at run-time.

locale/LanguageNames.txt is intended as a "source file" that is infrequently
changed as the set of supported languages changes.

The intermediate step, of appropriately copying that file into the C++ source
code in src/Languages.cpp, was done by hand.

In XCode, I set locale/LanguagesNames.txt and src/Languages.cpp to be
interpreted as Western encoding, and then the copy-paste was easy in the
editor.

The resulting C++ source code file now has string literals that are not 7-bit
ASCII.
This commit is contained in:
Paul Licameli
2018-01-02 16:10:35 -05:00
parent 1b19ab4f02
commit a1530c36a8
6 changed files with 126 additions and 77 deletions

View File

@@ -5,7 +5,7 @@ ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = audacity$(EXEEXT)
dist_doc_DATA = LICENSE.txt README.txt
dist_pkgdata_DATA = presets/EQDefaultCurves.xml locale/LanguageNames.txt
dist_pkgdata_DATA = presets/EQDefaultCurves.xml
nobase_dist_pkgdata_DATA = \
include/audacity/ConfigInterface.h \

View File

@@ -513,7 +513,7 @@ SUBDIRS = help images lib-src po src tests
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = audacity$(EXEEXT)
dist_doc_DATA = LICENSE.txt README.txt
dist_pkgdata_DATA = presets/EQDefaultCurves.xml locale/LanguageNames.txt
dist_pkgdata_DATA = presets/EQDefaultCurves.xml
nobase_dist_pkgdata_DATA = \
include/audacity/ConfigInterface.h \
include/audacity/EffectAutomationParameters.h \

View File

@@ -1,56 +1,59 @@
af Afrikaans
ar العربية
be Беларуская
bg Български
bn বাংলা
bs Bosanski
ca Català
ca_ES@valencia Valencià
cs Čeština
cy Cymraeg
da Dansk
de Deutsch
el Ελληνικά
en English
es Español
eu Euskara
eu_ES Euskara (Espainiako)
fa فارسی
fi Suomi
fr Français
ga Gaeilge
gl Galego
he עברית
hi हिन्दी
hr Hrvatski
hu Magyar
hy Հայերեն
id Bahasa Indonesia
it Italiano
ja 日本語
ka ქართული
km ខេមរភាសា
ko 한국어
lt Lietuvių
mk Македонски
my မြန်မာစာ
nb Norsk
nl Nederlands
oc Occitan
pl Polski
pt Português
pt_BR Português (Brasil)
ro Română
ru Русский
sk Slovenčina
sl Slovenščina
sr_RS Српски
sr_RS@latin Srpski
sv Svenska
ta தமிழ்
tg Тоҷикӣ
tr Türkçe
uk Українська
vi Tiếng Việt
zh_CN 中文
zh_TW 中文
// To edit this file, open as UTF-8 encoded Unicode
// To use the updated file, open as 8-bit ASCII, copy the strings, and paste
// over the table of names in src/Languages.cpp
"af Afrikaans",
"ar العربية",
"be Беларуская",
"bg Български",
"bn বাংলা",
"bs Bosanski",
"ca Català",
"ca_ES@valencia Valencià",
"cs Čeština",
"cy Cymraeg",
"da Dansk",
"de Deutsch",
"el Ελληνικά",
"en English",
"es Español",
"eu Euskara",
"eu_ES Euskara (Espainiako)",
"fa فارسی",
"fi Suomi",
"fr Français",
"ga Gaeilge",
"gl Galego",
"he עברית",
"hi हिन्दी",
"hr Hrvatski",
"hu Magyar",
"hy Հայերեն",
"id Bahasa Indonesia",
"it Italiano",
"ja 日本語",
"ka ქართული",
"km ខេមរភាសា",
"ko 한국어",
"lt Lietuvių",
"mk Македонски",
"my မြန်မာစာ",
"nb Norsk",
"nl Nederlands",
"oc Occitan",
"pl Polski",
"pt Português",
"pt_BR Português (Brasil)",
"ro Română",
"ru Русский",
"sk Slovenčina",
"sl Slovenščina",
"sr_RS Српски",
"sr_RS@latin Srpski",
"sv Svenska",
"ta தமிழ்",
"tg Тоҷикӣ",
"tr Türkçe",
"uk Українська",
"vi Tiếng Việt",
"zh_CN 中文",
"zh_TW 中文",

View File

@@ -3071,7 +3071,7 @@
5E15126A1DB0010C00702E29 /* TrackUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackUI.cpp; sourceTree = "<group>"; };
5E15126B1DB0010C00702E29 /* TrackVRulerControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackVRulerControls.cpp; sourceTree = "<group>"; };
5E15126C1DB0010C00702E29 /* TrackVRulerControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackVRulerControls.h; sourceTree = "<group>"; };
5E16FF4C1FF9CE0B0085E1B8 /* LanguageNames.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LanguageNames.txt; path = ../locale/LanguageNames.txt; sourceTree = "<group>"; };
5E16FF4C1FF9CE0B0085E1B8 /* LanguageNames.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = LanguageNames.txt; path = ../locale/LanguageNames.txt; sourceTree = "<group>"; };
5E2A19921EED688500217B58 /* SelectionState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionState.cpp; sourceTree = "<group>"; };
5E2A19931EED688500217B58 /* SelectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionState.h; sourceTree = "<group>"; };
5E3FFE701EC9032B0020F7C9 /* NoteTrackSliderHandles.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NoteTrackSliderHandles.cpp; sourceTree = "<group>"; };

View File

@@ -127,30 +127,77 @@ wxString GetSystemLanguageCode()
void GetLanguages(wxArrayString &langCodes, wxArrayString &langNames)
{
const char *utf8Names[] = {
"af Afrikaans",
"ar العربية",
"be Беларуская",
"bg Български",
"bn বাংলা",
"bs Bosanski",
"ca Català",
"ca_ES@valencia Valencià",
"cs Čeština",
"cy Cymraeg",
"da Dansk",
"de Deutsch",
"el Ελληνικά",
"en English",
"es Español",
"eu Euskara",
"eu_ES Euskara (Espainiako)",
"fa فارسی",
"fi Suomi",
"fr Français",
"ga Gaeilge",
"gl Galego",
"he עברית",
"hi हिन्दी",
"hr Hrvatski",
"hu Magyar",
"hy Հայերեն",
"id Bahasa Indonesia",
"it Italiano",
"ja 日本語",
"ka ქართული",
"km ខេមរភាសា",
"ko 한국어",
"lt Lietuvių",
"mk Македонски",
"my မြန်မာစာ",
"nb Norsk",
"nl Nederlands",
"oc Occitan",
"pl Polski",
"pt Português",
"pt_BR Português (Brasil)",
"ro Română",
"ru Русский",
"sk Slovenčina",
"sl Slovenščina",
"sr_RS Српски",
"sr_RS@latin Srpski",
"sv Svenska",
"ta தமிழ்",
"tg Тоҷикӣ",
"tr Türkçe",
"uk Українська",
"vi Tiếng Việt",
"zh_CN 中文",
"zh_TW 中文",
};
wxArrayString tempNames;
wxArrayString tempCodes;
LangHash localLanguageName;
LangHash reverseHash;
LangHash tempHash;
for ( auto utf8Name : utf8Names )
{
// The list of locales and associated self-names of languages
// is stored in an external resource file which is easier
// to edit as Unicode than C++ source code.
auto dir = FileNames::ResourcesDir();
wxTextFile file{dir + wxFILE_SEP_PATH + "LanguageNames.txt"};
file.Open();
for ( auto str = file.GetFirstLine(); !file.Eof();
str = file.GetNextLine() )
{
// Allow commenting-out of languages no longer supported
if (str[0] == '#')
continue;
auto code = str.BeforeFirst(' ');
auto name = str.AfterFirst(' ');
localLanguageName[code] = name;
}
auto str = wxString::FromUTF8(utf8Name);
auto code = str.BeforeFirst(' ');
auto name = str.AfterFirst(' ');
localLanguageName[code] = name;
}
wxArrayString audacityPathList = wxGetApp().audacityPathList;

View File

@@ -98,7 +98,6 @@ Source: "{#AppExe}"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\help\manual\*"; DestDir: "{app}\help\manual\"; Flags: ignoreversion recursesubdirs
Source: "..\presets\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "..\locale\LanguageNames.txt"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
; wxWidgets DLLs. Be specific (not *.dll) so we don't accidentally distribute avformat.dll, for example.
; Don't use the WXWIN environment variable, because...