Re: [Tuxpaint-i18n] Localized names of file paths?
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
|
From: Bill K. <nb...@so...> - 2024-04-27 20:55:23
|
On Sat, Apr 27, 2024 at 11:30:41AM -0700, Bill Kendrick wrote:
>
> I'm doing a little bit of work over in the `tuxpaint-docs` repo
> (the PHP + gettext source of the HTML docs that are then sync'd
> over to the main `tuxpaint` repo, to be part of a release) to
> modularize how filenames and paths are managed.
I'm done (for now) reworking a lot of places throughout the docs.
I wanted to let folks know that in a few places, I simplified
things, meaning fewer strings (since I use the same string
more consistently.)
However, in many places, I replaced junk like this:
sprintf(
gettext("The file is \"%s\".",
"<code>/path/to/file.txt</code>")
)
with junk like this:
sprintf(
gettext("The file is %s.",
code_path(
$PATHS['os']['somefile'],
true /* wrap in quotes */
)
)
As you can see the quotes (") around the string argument (%s)
have been removed. This is going to cause a lot of strings
in the PO files to get out of date, sorry about that. :-(
The reason was to prevent the plaintext renderings of the
documentation (HTML -> TXT) to end up wordwrapping awkwardly,
like so:
The file is "
/path/to/file.txt".
Under the hood, it means the HTML changes from, in the worst
case scenario:
The file is "<code>/path/to/file.txt</code>".
...meaning even the path itself could word-wrap:
The file is "/path/
to/file.txt".
To this:
The file is <nobr>"<code>/path/to/file.txt</code>"</nobr>.
...so the file path will never get split up, it will appear as:
The file is
"/path/ot/file.txt".
Hopefully the above all makes sense.
Along with avoiding splits on "/" or "\" (Windows), it
also prevents splits on any folder names that contain
spaces (like "C:\Program Files\" on Windows). :-)
I'm certain I have a lot more clean-up I can do in there,
which will undoubtedly cause even _more_ strings to change
a little. I'm hopeful the improvement in consistency
(and lack of weird word wrapping) is worth the annoyance. :^)
-bill!
|