From: tmoran@bix.com
Subject: Re: I18N gettext style
Date: 2000/03/05
Date: 2000-03-05T00:00:00+00:00 [thread overview]
Message-ID: <U_iw4.2838$im1.54677@news.pacbell.net> (raw)
In-Reply-To: lO3w4.2212$im1.45673@news.pacbell.net
>Is there any reason you used print0, print1, print2, instead of
>print, print, print? My instinct is to overload them.
The only reason is that I was trying to code after midnight. #.#
>Or %1 and %2, for compatibility with current systems.
How about producing:
Hi!
Hi! There are 3 widgets!
Hi! There are 3 parts, code 1234!
Hi! For $99.95 you can buy 3 parts, code 1234!
using
with ada.text_io,
ada.text_io.editing;
use ada.text_io,
ada.text_io.editing;
procedure test is
procedure print(s : in string;
p1 : in string := "";
p2 : in string := "";
p3 : in string := "") is
si : integer := s'first;
begin
while si <= s'last loop
if si < s'last and then s(si) = '%' then
case s(si+1) is
when '1' => put(p1);
when '2' => put(p2);
when '3' => put(p3);
when others => null;
end case;
si := si+2;
else
put(s(si));
si := si+1;
end if;
end loop;
new_line;
end print;
count : integer := 3;
id : integer := 1234;
type money is delta 0.01 digits 5;
package print_money is new ada.text_io.editing.decimal_output(money);
money_picture : constant picture := to_picture("-$$9.99");
price : money := 99.95;
begin
print("Hi!");
print("Hi! There are%1 widgets!",
integer'image(count));
print("Hi! There are%1 parts, code%2!",
integer'image(count),
integer'image(id));
print("Hi! For%3 you can buy%1 parts, code%2!",
integer'image(count),
integer'image(id),
print_money.image(price, money_picture));
end test;
next prev parent reply other threads:[~2000-03-05 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-04 0:00 I18N gettext style David Starner
2000-03-04 0:00 ` tmoran
2000-03-04 0:00 ` David Starner
2000-03-05 0:00 ` Jeff Carter
2000-03-05 0:00 ` Ehud Lamm
2000-03-05 0:00 ` tmoran [this message]
2000-03-06 0:00 ` Nick Roberts
2000-03-06 0:00 ` David Starner
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox