mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
new logic for enabling translation in bundled releases of ardour
git-svn-id: svn://localhost/ardour2/branches/3.0@13980 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
f08f3acbac
commit
bc2523c249
4 changed files with 49 additions and 9 deletions
|
|
@ -149,7 +149,7 @@ fixup_bundle_environment (int, char* [])
|
||||||
bundle_dir = Glib::path_get_dirname (exec_dir);
|
bundle_dir = Glib::path_get_dirname (exec_dir);
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
if (ARDOUR::translations_are_disabled ()) {
|
if (!ARDOUR::translations_are_enabled ()) {
|
||||||
localedir = "/this/cannot/exist";
|
localedir = "/this/cannot/exist";
|
||||||
export_search_path (bundle_dir, "GTK_LOCALEDIR", "/Resources/locale");
|
export_search_path (bundle_dir, "GTK_LOCALEDIR", "/Resources/locale");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -237,7 +237,7 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
|
||||||
std::string userconfigdir = user_config_directory();
|
std::string userconfigdir = user_config_directory();
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
if (ARDOUR::translations_are_disabled ()) {
|
if (!ARDOUR::translations_are_enabled ()) {
|
||||||
localedir = "/this/cannot/exist";
|
localedir = "/this/cannot/exist";
|
||||||
export_search_path (dir_path, "GTK_LOCALEDIR", "/this/cannot/exist");
|
export_search_path (dir_path, "GTK_LOCALEDIR", "/this/cannot/exist");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1684,6 +1684,17 @@ RCOptionEditor::RCOptionEditor ()
|
||||||
|
|
||||||
/* USER INTERACTION */
|
/* USER INTERACTION */
|
||||||
|
|
||||||
|
if (getenv ("ARDOUR_BUNDLED")) {
|
||||||
|
add_option (_("User interaction"),
|
||||||
|
new BoolOption (
|
||||||
|
"enable-translation",
|
||||||
|
string_compose (_("Use translations of %1 messages\n"
|
||||||
|
" <i>(requires a restart of %1 to take effect)</i>\n"
|
||||||
|
" <i>(if available for your language preferences)</i>"), PROGRAM_NAME),
|
||||||
|
sigc::ptr_fun (ARDOUR::translations_are_enabled),
|
||||||
|
sigc::ptr_fun (ARDOUR::set_translations_enabled)));
|
||||||
|
}
|
||||||
|
|
||||||
add_option (_("User interaction"), new OptionEditorHeading (_("Keyboard")));
|
add_option (_("User interaction"), new OptionEditorHeading (_("Keyboard")));
|
||||||
|
|
||||||
add_option (_("User interaction"), new KeyboardOptions);
|
add_option (_("User interaction"), new KeyboardOptions);
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,10 @@ namespace ARDOUR {
|
||||||
|
|
||||||
void find_bindings_files (std::map<std::string,std::string>&);
|
void find_bindings_files (std::map<std::string,std::string>&);
|
||||||
|
|
||||||
std::string translation_kill_path ();
|
/* these only impact bundled installations */
|
||||||
bool translations_are_disabled ();
|
std::string translation_enable_path ();
|
||||||
|
bool translations_are_enabled ();
|
||||||
|
bool set_translations_enabled (bool);
|
||||||
|
|
||||||
static inline microseconds_t get_microseconds () {
|
static inline microseconds_t get_microseconds () {
|
||||||
return (microseconds_t) jack_get_time();
|
return (microseconds_t) jack_get_time();
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdio> // Needed so that libraptor (included in lrdf) won't complain
|
#include <cstdio> // Needed so that libraptor (included in lrdf) won't complain
|
||||||
|
#include <cstdlib>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
@ -465,19 +466,45 @@ ARDOUR::setup_fpu ()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this can be changed to modify the translation behaviour for
|
||||||
|
cases where the user has never expressed a preference.
|
||||||
|
*/
|
||||||
|
static const bool translate_by_default = true;
|
||||||
|
|
||||||
string
|
string
|
||||||
ARDOUR::translation_kill_path ()
|
ARDOUR::translation_enable_path ()
|
||||||
{
|
{
|
||||||
return Glib::build_filename (user_config_directory(), ".love_is_the_language_of_audio");
|
return Glib::build_filename (user_config_directory(), ".translate");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ARDOUR::translations_are_disabled ()
|
ARDOUR::translations_are_enabled ()
|
||||||
{
|
{
|
||||||
/* if file does not exist, we don't translate (bundled ardour only) */
|
if (Glib::file_test (translation_enable_path(), Glib::FILE_TEST_EXISTS)) {
|
||||||
return Glib::file_test (translation_kill_path(), Glib::FILE_TEST_EXISTS) == false;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return translate_by_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ARDOUR::set_translations_enabled (bool yn)
|
||||||
|
{
|
||||||
|
string i18n_enabler = ARDOUR::translation_enable_path();
|
||||||
|
|
||||||
|
if (yn) {
|
||||||
|
int fd = ::open (i18n_enabler.c_str(), O_RDONLY|O_CREAT, 0644);
|
||||||
|
if (fd >= 0) {
|
||||||
|
close (fd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return unlink (i18n_enabler.c_str()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vector<SyncSource>
|
vector<SyncSource>
|
||||||
ARDOUR::get_available_sync_options ()
|
ARDOUR::get_available_sync_options ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue