XP is just a number | |
PerlMonks |
Hashes, File sizes, Translations, OH MY!by hacker (Priest) |
on May 29, 2004 at 14:47 UTC ( [id://357479]=perlquestion: print w/replies, xml ) | Need Help?? |
hacker has asked for the wisdom of the Perl Monks concerning the following question:
I have a series of files which are auto-generated hourly, based on commits from developers and community members who maintain these files. Currently there are 14 languages that we support. Our public website has a page which contains links to these files, including filename, size, and date of the file itself, so users who wish to use these "snapshots", can make sure they are current, etc.
To do this, I'm currently rolling through a directory where these files are placed, and fetching the information as follows:
This part works, but produces a very lengthy list of files, in a non-human ordering. What I'd like to do, is compress that output a bit, so that I have a hash (??) lookup of the languages, which are then tacked onto the filename (so "English" matches up with strings_en.txt, Spanish matches up with strings_es.txt). We know the extensions of the languages we support (_es for Spanish, _fr for Francais, etc.). Ideally, the output would look something like this:
The piece of this that I'm struggling with, is how to make the "human" names (English, Deutsch, French) match up with the file extensions (_en, _de, _fr respectively), and then for each of those (${file}${lang}.txt), find the file size and date (File::Find here), and output them in alphabetical order by their "human" names (Catalan before Chinese, etc.) Any hints/tips that would help?
Back to
Seekers of Perl Wisdom
|
|