Commit Graph

93 Commits

Author SHA1 Message Date
Vadim Zeitlin
8cb4e70064 Refactor wxLocale initialization code
Don't call wxSetlocale() in DoInit() any more, this was redundant when
it was called from Init(wxLanguage) overload.

Add new DoCommonPostInit() called from both Init() overloads after
setting the locale in whichever way they do it to avoid code
duplication.

As a side effect of this change, the error message given if the locale
can't be set is the same now independently of the ctor/Init() overload
used (previously it differed depending on whether a wxLanguage or the
name of the language as string was passed) and it's always logged using
wxLogWarning() and not it in one case and wxLogError() in the other one.
2017-07-16 15:03:22 +02:00
Vadim Zeitlin
8713d73466 Avoid at least some unnecessary setlocale() calls
Instead of calling wxLanguageInfo::GetLocaleName(), which called
setlocale() at least thrice (first to query the current locale, second
to try to change it and third to restore the original locale) and then
calling setlocale() again if it succeeded, use the new TrySetLocale()
method which calls setlocale() just once and doesn't require calling it
again in the caller.

This makes the code slightly more efficient but, more importantly,
shorter and more clear.
2017-07-16 15:03:17 +02:00
Vadim Zeitlin
7836dfbc77 Make wxLanguageInfo::GetLocaleName() consistent across platforms
Check that the locale can be indeed set to the given string in Unix
version too, there doesn't seem to be any good reason to do it for MSW
only.
2017-07-16 15:03:03 +02:00
Vadim Zeitlin
9fc78c8167 Add wxLocale::GetOSInfo() and use it in MSW wxDateTimePickerCtrl.
This fixes the size of wxDateTimePickerCtrl in programs that don't set any
specific locale: previously, the standard "%m/%d/%y" format was used for
computing the best size of the control in this case, but this could have been
significantly shorter than the format actually used (compare with the default
"%d %b, %Y"), resulting in the control contents being truncated by default.

GetOSInfo() is currently different from GetInfo() only under MSW, but we might
need to make the same distinction under OS X too, so do make this function
public instead of keeping it MSW-specific.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-12-05 22:17:13 +00:00
Václav Slavík
acebfdf052 Remove unused wxLocale::GetUntranslatedString().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-09-18 16:03:28 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Vadim Zeitlin
d98a58c543 Use __WINDOWS__ for OS kind checks and reserve __WXMSW__ for GUI toolkit.
This change prepares the way for using wxGTK under Windows as this would
still define __WINDOWS__ but use __WXGTK__ instead of __WXMSW__.

Closes #14064.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-04 00:29:31 +00:00
Václav Slavík
dfbb5eff44 Don't use size_t for plural forms parameter.
size_t should be used for size of objects, which wxGetTranslation() and
wxTranslations::GetString() 'n' argument isn't -- it's just a regular
integer.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64215 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-05 12:27:07 +00:00
Václav Slavík
0d28a1f927 Always use active wxTranslations instance via wxLocale.
Don't use m_translations directly, if the user made changes to
wxTranslations instance, it would be too confusing if calls through
wxLocale compat API did nothing.

Also don't change active wxTranslations object from wxLocale if already
done by user, only call wxTranslations::Set() from wxLocale constructor
if it wasn't already set by the user. Still do if wxTranslations
instance currently in use was set by previous wxLocale on the locale
stack.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64165 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-29 08:31:42 +00:00
Václav Slavík
ea14492351 Split intl.h into intl.h, language.h and translation.h.
To make the code more manageable, intl.h now contains wxLocale and
translation.h all translations-related stuff (wxTranslations, _() etc.).
Code generated by genlang.py was moved into its own files (language.h,
languageinfo.cpp).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-24 07:06:32 +00:00
Václav Slavík
18e065b48d Split wxLocale into wxLocale and wxTranslations.
wxTranslations is for handling gettext translations. wxLocale manages
locale and provides compatiblity API for translations. Separating these
two loosely related tasks makes it possible to use translations into
languages not known by Windows or using localized GUI without all the
locales compilations.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-24 07:06:18 +00:00
Václav Slavík
1be1262444 Fix build breakage caused by bConvertEncoding deprecation.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64003 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-16 20:09:00 +00:00
Václav Slavík
3acf8a8d9b Remove wxLOCALE_CONV_ENCODING flag.
This doesn't affect Unicode builds, only the legacy ANSI one.

PO files are now always converted to the appropriate charset according
to current locale. This was the default behavior for long time; not
doing the conversion was always a fragile hack that didn't work well.
Removing this flag simplifies wxLocale code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-16 11:29:22 +00:00
Václav Slavík
f30bd8f262 Add wxLOCALE_DONT_LOAD_DEFAULT (=0) for clarity.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-16 11:29:09 +00:00
Vadim Zeitlin
86c30bc557 added Asturian language entry (see #10808)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-05-19 10:51:11 +00:00
Vadim Zeitlin
89a7e1ff98 Added wxLOCALE_DATE/TIME_FMT support to wxLocale::GetInfo().
- Implement for POSIX and Win32, TODO for OS X
- Use this instead of ad hoc code in wxDateTime::ParseFormat()
- Remove HAVE_STRPTIME, we don't need nor use strptime() any more


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-29 17:15:43 +00:00
Vadim Zeitlin
c0c133e13b add wx-prefixed and semicolon-requiring versions of DECLARE_NO_{COPY,ASSIGN}_CLASS macros
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-08 11:45:59 +00:00
Vadim Zeitlin
7bf2b0881a added language info for Northern Sami (patch 1964036)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-17 22:49:30 +00:00
Vadim Zeitlin
b5e2a45022 add ka_GE, ku_TR and ne_NP; some cleanup and better handling of sr_XX (patch 1858926)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51864 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-17 20:11:17 +00:00
Vadim Zeitlin
86d62b51c0 add wxLanguageInfo::GetLocaleName(), this simplifies the current code and will be used with wxXLocale
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51669 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-11 23:40:03 +00:00
Vadim Zeitlin
ea65760d5c avoid duplication in the code by refactoring LCID creation from wxLanguageInfo::WinLang and WinSublang in a member function
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51668 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-11 23:23:10 +00:00
Paul Cornett
e0749635a5 HP aC++ 3.80 can't handle parenthesized string literal in an initializer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51417 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-28 04:15:11 +00:00
Vadim Zeitlin
066f3611df don't use _T() inside wxGetTranslation() and related macros (wxTRANSLATE, _, ...) to preserve compatibility with the old ASCII build (even at the expense with the Unicode build compatibility)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-09-07 19:34:56 +00:00
Václav Slavík
b5dbe15d0b added WXDLLIMPEXP_FWD_FOO macros in addition to WXDLLIMPEXP_FOO for use with forward declarations (in preparation for GCC visibility support)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-09 10:09:52 +00:00
Václav Slavík
52de37c78f 1. made CRT wrappers definitions indepenent of wxUSE_UNICODE: both ANSI and Unicode variants are now defined
2. split wxcrt.h into wxcrtbase.h with lowlevel compiler-specific definitions and wxcrt.h with ANSI- and Unicode-compatible wx wrappers


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-10 17:14:14 +00:00
Václav Slavík
a64be16ef8 return reference to non-temporary wxString instance from wxGetTranslation() even when not translating
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46144 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-21 17:44:37 +00:00
Václav Slavík
df08bf5ab3 added inline plural form of wxGetTranslation to wxUSE_INTL=0 case for use with non-default domain too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-01 21:19:02 +00:00
Václav Slavík
2765cbb5aa define wxPLURAL even if wxUSE_INTL=0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45739 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-01 21:13:56 +00:00
Václav Slavík
31b7522e2b use wxStrings in wxLocale methods, _() and wxGetTranslation(), so that it can be used with any string literals
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45080 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-26 21:05:04 +00:00
Václav Slavík
33046a8283 fixed wxGetTranslation() prototype in the !wxUSE_INTL case
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44285 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-01-22 12:26:19 +00:00
Vadim Zeitlin
cec5ffc46d added wxLocale::IsAvailable() (extended patch 1547191)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-09-10 23:28:20 +00:00
Włodzimierz Skiba
b137e49318 Build fix.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41008 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-09-04 19:22:57 +00:00
Vadim Zeitlin
978af86426 merge of RTL changes (with many modifications) from SOC2006_RTL branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40994 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-09-04 13:35:13 +00:00
Robin Dunn
d4a724d407 Make it possible to tell wxXmlResource which domain to pull
translatable strings from.

Make the wxLocale::GetString methods virtual so they can be overridden
in derived classes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-08-21 18:27:15 +00:00
Mart Raudsepp
8907154c1a Nuke #pragma implementation/interface's
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35650 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-09-23 12:56:45 +00:00
Vadim Zeitlin
15d0695440 added wxPLURAL() macro
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-06-01 21:16:30 +00:00
Julian Smart
3103e8a97e Typo correction patch [ 1208110 ] Lots of typo corrections
Olly Betts


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-05-31 09:20:43 +00:00
Włodzimierz Skiba
7beb59f36c Source cleaning: whitespaces, tabs, -1/wxDefaultCoord/wxNOT_FOUND, TRUE/true, FALSE/false, !!/!IsEmpty().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-09-16 18:13:32 +00:00
Vadim Zeitlin
c48908df67 added GetHeaderValue() (patch 974427)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-07-25 15:30:42 +00:00
Václav Slavík
d721baa9e6 allow msgids in !=English languages (based on Stefan Kowski's patch)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-06-23 20:30:32 +00:00
Vadim Zeitlin
64764f5077 fix for a warning in DLL build (patch 966823)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-06-22 23:33:44 +00:00
Julian Smart
655719367a Use old licence name
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-05-23 20:53:33 +00:00
Julian Smart
77ffb5937e Name and version changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-05-23 14:56:36 +00:00
Vadim Zeitlin
ea8f6fc718 initialize m_initialized to false to avoid spurious asserts
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26247 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-03-17 22:20:42 +00:00
Václav Slavík
3202d00dc9 assert if wxLocale::Init called twice
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24668 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2003-11-26 19:33:35 +00:00
Václav Slavík
9d814be8d0 don't define ngettext, causes problems
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2003-11-19 20:51:05 +00:00
Václav Slavík
ba9d03fa13 1) use ngettext instead of _N, 2) cleanup of gettext macros definitions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24168 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2003-10-13 21:27:02 +00:00
Václav Slavík
849a28d0da added gettext plural forms support (patch #785660 with modifications)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24085 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2003-10-04 22:38:00 +00:00
Václav Slavík
1202890513 added support for gcc precompiled headers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2003-08-09 12:38:21 +00:00
Vadim Zeitlin
bddd7a8d89 renamed WXDLLEXPORT_BASE/CORE to WXDLLIMPEXP_BASE/CORE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2003-07-02 01:59:24 +00:00