From b09703eb12132edc03bf3c5ed504c907f86ea375 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lureau Date: Tue, 3 Jun 2008 18:38:48 +0300 Subject: Add subnames lookup: truncatesuffix for soundname --- spec/sound-naming-spec.xml | 8 ++++---- spec/sound-theme-spec.xml | 22 ++++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/spec/sound-naming-spec.xml b/spec/sound-naming-spec.xml index df83421..be8a025 100644 --- a/spec/sound-naming-spec.xml +++ b/spec/sound-naming-spec.xml @@ -68,7 +68,7 @@ usage. Context - The list of default Contexts for the sound theme are: + The list of default contexts for the sound theme are: @@ -132,8 +132,8 @@ usage. Sound names are in the en_US.US_ASCII locale. This means - that the allowable characters in the sound names, must - fall withing the US-ASCII character set. As a further + that the characters allowed in the sound names must + fall within the US-ASCII character set. As a further restriction, all sound names may only contain lowercase letters, numbers, underscore, dash, or period characters. Spaces, colons, slashes, and backslashes are @@ -178,7 +178,7 @@ usage. Alerts This is to notify the user of an action or event which may - have a major imact on the system or their current use case. + have a major impact on the system or their current use case.
diff --git a/spec/sound-theme-spec.xml b/spec/sound-theme-spec.xml index 3da8e75..5b5f282 100644 --- a/spec/sound-theme-spec.xml +++ b/spec/sound-theme-spec.xml @@ -453,18 +453,20 @@ FindSoundHelper(sound, locale, outputprofile, theme) { With the following helper functions: -LookupSound (sound, locale, requestedoutputprofile, requestedtheme) { +LookupSound (soundname, locale, requestedoutputprofile, requestedtheme) { // lookup localized version for theme in (requestedtheme, "freedesktop", "") { - for each locale in ($locale, truncate($locale, "@"), truncate($locale, "_"), "C", "") - for profile in (requestedoutputprofile, "stereo", "") { - for each subdir in $(theme subdir list) { - if DirectoryMatchesOutputProfile(subdir, profile) { - for each directory in $(basename list) { - for extension in ("wav", "ogg") { - filename = directory/$theme/subdir/locale/sound.extension - if exist filename - return filename + for each locale in ($locale, truncateprefix($locale, "@"), truncateprefix($locale, "_"), "C", "") + for each subname in (soundname, truncatesuffix(soundname), truncatesuffix(truncatesuffix(soundname)), ...) + for profile in (requestedoutputprofile, "stereo", "") { + for each subdir in $(theme subdir list) { + if DirectoryMatchesOutputProfile(subdir, profile) { + for each directory in $(basename list) { + for extension in ("wav", "ogg") { + filename = directory/$theme/subdir/locale/subname.extension + if exist filename + return filename + } } } } -- cgit