Commit Graph

50 Commits

Author SHA1 Message Date
Dave Hoover 1926012bc5 Remove now spurious casts
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6016 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-01-13 19:19:15 +00:00
Dave Hoover fdf51a634a Welcome to the future.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6008 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-01-04 21:47:46 +00:00
Charlie Groves 505a9c3a53 Make MessageBundle.getResourceString public so MessageBundles can be composed instead of requiring inheritance to customize them, and open up the bundle creation process in MessageManager to subclass customization
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5901 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-12 20:04:36 +00:00
Michael Bayne 6e9077780c Added/updated source headers.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5829 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-06-20 21:09:34 +00:00
Michael Bayne 5bd1ef9d8c Use new isTainted and untaint methods.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5680 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-03-05 01:22:49 +00:00
Mike Thomas d14937991a Allow those using message bundles to get all the keys that start with a particular prefix, just like they can get all the translations that match a prefix.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5555 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-11-18 19:25:19 +00:00
Dave Hoover 657aafaedb And of course, if I were thinking this morning, I would've rerun the organize imports
thing before committing instead of just going "oh yeah, I've been having this stuff
sitting around uncommitted for a while waiting on it to be blessed" and missing
out on things that'd changed in the meantime.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5400 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-09-26 17:35:29 +00:00
Dave Hoover 18a69ba281 It's potentially poor form to be passing null in as one of the
things to stuff into a translated string, but I've seen it happen
in internalish yohoho messages, so let's not blow up.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5339 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-08-25 17:21:53 +00:00
Bruno Garcia c5bc67d66a Planting a flag on this landmine, change to equals() if desired
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5327 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-08-15 23:55:46 +00:00
Bruno Garcia f632356dfc Only go through getSuffix once, and don't call getResourceString more than necessary.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5325 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-08-15 22:41:38 +00:00
Bruno Garcia 29204b385d If the suffixed message key for integers is missing, fall back to the unsuffixed key instead of banking on the ".n" suffix.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5323 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-08-15 21:45:36 +00:00
Michael Bayne fcedbe90d7 Thread.dumpStack() circumvents whatever logging is configured and writes
directly to stderr. Logging an exception with the associated warning does the
right thing and logs the stack trace via the logging system.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5318 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-08-13 17:35:37 +00:00
Michael Bayne 0a893e1de1 ZOMG, Narya now perfectly passes our coding standards as enforced by
CheckStyle. The checks are slightly looser than I'd like but way better than
nothing and we get a bunch of other useful warnings like shadowed names and
other handy bits.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5253 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-07-22 14:36:54 +00:00
Dave Hoover 6b1d65553f And finally, narya gets the imports/overrides/regen love.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5241 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-07-18 23:20:17 +00:00
Michael Bayne 09f0bee0f3 Yet more header patrol.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4602 542714f4-19e9-0310-aa3c-eee0fc999fb1
2007-02-24 00:39:27 +00:00
Michael Bayne eda71de8d3 Added another method that's booching GG games.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4383 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-27 16:59:38 +00:00
Michael Bayne 16689b51d4 We need these for binary compatibility with existing Game Gardens games. We may
need the two argument versions as well, but I'll wait and see.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4378 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-25 05:27:09 +00:00
Ray Greenwell 5a8b9e14db Lovely varargs, like MessageUtil in samskivert.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4368 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-11 22:16:01 +00:00
Michael Bayne e4d7da7d19 Added getAll().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4300 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-07 19:04:48 +00:00
Michael Bayne f665a5b2ea Added toString(), moved static methods to top.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4298 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-07 17:25:13 +00:00
Michael Bayne ecac8e0f6d Move to our new Java logging based logging style which also fixes a conflict
between logging in the Narya util package and the Nenya util package.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4214 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-23 19:32:51 +00:00
Ray Greenwell 79c6427c21 StringBuffer -> StringBuilder.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4191 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-06-13 22:42:20 +00:00
Michael Bayne a9720fd905 LGPLed the library. Hello world.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3099 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-27 02:21:06 +00:00
Ray Greenwell 5f4c4e82fd Prevent an ArrayStoreException when doing magical number pluralizing if
the array of arguments happens to be a String[].


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3094 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-23 23:21:40 +00:00
Michael Bayne 57a1cd774a Revamped the plural message selection code to magically activate itself
when appropriate and to automatically extract and use the integer value
even if it's a string so that we can compose up messages with
plural-customized versions just like we do regular messages. Magic++!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3093 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-23 22:53:39 +00:00
Michael Bayne 32dee3cbaf 405 modified source files and 17,367 lines of diffs later we now enforce
more discipline when handling names in our code base. Any user entered
name should find its way into a Name object as soon as it comes out of a
text field or whatnot, and stay that way until it makes its way into a
text field or into a database record (for which String objects are vastly
simpler because of JORA magic).

Dear God, let me never again make a change this large for the rest of my
mortal life.

Unfortunately, this means we have to keep an eye out for funny business
pretty much everywhere. However, since we will absolutely want to test
market stalls and so forth on Azure, we'll have an opportunity to iron out
any funny business that might fall under the radar during our internal
testing.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2980 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-03-06 11:29:19 +00:00
Michael Bayne 072606b23a Added exists().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2949 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-02-05 17:39:03 +00:00
Michael Bayne 3efc81b1ab We want to fall back to our parent bundle both if we don't find a resource
or if we have no resource bundle at all ourselves.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2941 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-01-25 13:23:09 +00:00
Michael Bayne 9cfe784c2f Use the appropriate methods from MessageUtil and provide pass-throughs for
our zillions of lines of code that expect the methods to be in
MessageBundle.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2902 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-12-11 06:34:43 +00:00
Michael Bayne 98e59b847e I discovered that ResourceBundle messages finally seem to do the right
thing with unescaped ticks (') which led me to modify MessageBundle to
automatically escape ticks before passing things to MessageFormat. This
allows us to use unescaped ticks willy nilly in our translation strings.
Yay! No more annoying worrying about whether we should use \' or '' or
having things be booched because we forgot one or the other.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2850 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-11-05 23:10:43 +00:00
Michael Bayne 8e820811bc No reason that embedded translation strings can't also be qualified (it's
quite necessary in fact).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2594 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-05-20 20:58:31 +00:00
Michael Bayne 7295ef9f87 Add support for handling plurality more simply.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2300 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-03-05 23:27:39 +00:00
Walter Korman 3d2e98f7da Fixed typo in comments. Tried to resist due to negligibility of typo, but
the perfectionist in me got the better of, me.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2061 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-12 22:27:25 +00:00
Michael Bayne d6f5a4da4d Added support for fully qualified translation messages which will be
fetched from the message bundle embedded in the fully qualified key even
if they are being translated within the context of another message bundle.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2060 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-12 22:24:51 +00:00
Michael Bayne 58d728aa91 Log a stack trace if we're missing a translation message so that it's easy
to track down the offender.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1933 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-11-12 08:18:03 +00:00
Michael Bayne 80b97158d2 Don't attempt further translation on tainted arguments in compound
translation keys. They might contain | which would cause xlate() to think
that they were another compound key.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1931 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-11-10 03:14:45 +00:00
Michael Bayne b07fef8396 Added support for a global message bundle to which other bundles fall back
if they can't find a message in their own list of strings.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1876 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-11-01 00:01:37 +00:00
Michael Bayne e8c7ba6084 Not to freak out if some unruly caller sends us null arguments.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1648 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-08-16 19:31:39 +00:00
Michael Bayne b07fbe123b Added mechanism for fetching resource strings that doesn't complain when
they don't exist.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1390 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-05-24 20:33:30 +00:00
Walter Korman f0ebe247e4 Fixed javadoc typo.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1349 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-05-08 21:15:26 +00:00
Ray Greenwell 9503d37d90 added getResourceString() which actually gets the business from
the ResourceBundle, making this class easy to extend...


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1323 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-05-01 03:39:13 +00:00
Michael Bayne 3f91aed3aa Added code to allow the creation of custom message bundles to go along
with a particular bundle's translation files. Mainly so Ray can do his
funny business with the pirate message translations.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1321 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-05-01 02:45:00 +00:00
Michael Bayne d026daa466 Not to choke if we can't resolve a resource bundle.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1320 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-04-30 17:45:27 +00:00
Michael Bayne 95ed4b001d Minor edit.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1164 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-03-27 21:52:41 +00:00
Walter Korman a76d37cc27 Added a variant of tcompose() that takes an array of string arguments.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1156 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-03-27 07:09:04 +00:00
Walter Korman 001932b5a5 Added tcompose() that calls the various permutations of compose() whilst
automatically tainting the arguments for yon intrepid programmer.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1082 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-03-01 17:10:30 +00:00
Michael Bayne d3e5912ef5 Javadoc edits.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1080 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-02-28 23:16:42 +00:00
Michael Bayne 6c8f613050 Fixed up xlate() to support recursive composed translations by providing a
method for composing a translation key and arguments into a single string
which is later decoded by the call to xlate(). This also requires that
unsafe strings (those entered by the user which should not be translated)
be marked with the new taint() method so that xlate() knows not to try to
translate those when it is recursively translating everything in sight.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1079 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-02-28 23:13:54 +00:00
Michael Bayne 2c50369bd3 Comment reformatting; added xlate() which is like the get() variants
except that it extracts the translation string key and arguments from a
compound key which is a tab-separated list of strings.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@976 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-02-09 01:35:26 +00:00
Michael Bayne 617d0e8cb0 Initial revision of localization support classes.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@893 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-01-29 20:44:35 +00:00