> On Aug. 14, 2014, 4:58 p.m., David Edmundson wrote: > > applets/fuzzy-clock/package/contents/ui/FuzzyClock.qml, line 118 > > <https://git.reviewboard.kde.org/r/119738/diff/1/?file=304020#file304020line118> > > > > we don't need the i18n here, we'd be trying to translate an already > > translated string. > > > > hourNames[Math.floor()] seems wrong, would that not give us > > > > 5 to 9 > > > > when it's 9:55? > > Kai Uwe Broulik wrote: > Ah, that is why :) > > Hmm, the original implementation just casts to int, I think. Would a > Math.round fix that? > > Kai Uwe Broulik wrote: > But honestly I don't really get that fuzzy logic either. Will test. > > Marco Martin wrote: > Math.round seems more correct, yes > > David Edmundson wrote: > I don't think either works. Assume the time is 10:30 > > in English that's half past ten. > In German that's half to eleven. > > Not sure how to solve that. > > Kai Uwe Broulik wrote: > > http://websvn.kde.org/*checkout*/branches/stable/l10n-kde4/de/messages/kdeplasma-addons/plasma_applet_fuzzy_clock.po > > That is the German translation file. And it does some "30 Minuten nach > %1|/|halb $[stunde+1 %1]" magic. How does that work? eins|/|$[Eigenschaft > stunde+1 zwei] $[Eigenschaft vollestunde ein] ?! So I guess here lies the > trick. > > Lasse Liehu wrote: > This is scripting translations using Transcript, > https://techbase.kde.org/Localization/Concepts/Transcript > > A property stunde+1 is added to each hour message. For example "one" is > translated as "eins|/|$[Eigenschaft stunde+1 zwei] $[Eigenschaft vollestunde > ein]". Then translation of "half past %1" uses that property by calling > "$[stunde+1 %1]", which returns "zwei". > > Kai Uwe Broulik wrote: > Thanks for the reference! So what adjustments are needed in the plasmoid, > or should it just work the way it is now? > > David Edmundson wrote: > this definitely won't work as-is. > > you're putting a string that's translated back into i18n. So you'll be > running > i18n("zehn nach %1", 11), the first argument won't match anything in the > .pot file which is looking for "ten past %1", so it'll just fail to find > anything but if you do a simple find and replace on $1 to the hour, you won't > get this transcript thing running. > > Hardcoding a hack for this won't work as we also need the 10:25 going to > "five to half to eleven" that we have in German. > > I think we're going to need methods in kdeclarative that return > KLocalizedStrings exposed via ki18nc. Then add expose these as QML metatypes. > Then we need to add i18, i18c, i18nc, i18d, i18ncd methods that accept > KLocalizedStrings as arguments as a first arg QStrings.. for every amount of > arguments. > > Or you can make everyone learn English where we're all normal. > > Lasse Liehu wrote: > Exactly. Just wondering, would it be easier to have functions like subs > (for inserting parameters) and toString (converting into final translated > string) in KLocalizedString in QML? There is no need to have each variant of > i18n take a KLocalizedString, is there? > > David Edmundson wrote: > /Maybe/ we'd have to wrap KLocalizedString in a QObject (or wait for > Q_GADGET changes). > > Actually we don't need to have to change each existing i18, but have > methods like: > Q_INVOKABLE KLocalisedSubString(KLocalisedString kls, const QSTring > &arg1, QString arg2=(), QString arg3=()); > Q_INVOKABLE KLocalisedToString(KLocalisedString kls); > > we still need all the ki18n variants though :(
I'm an idiot. There's a far far easier solution that doesn't involve changing kdeclarative. Instead of having an array in readonly property var normalFuzzy. have a function createstring(int fuzzy, int hour) { switch (index) { case 0: return i18n("five past %1", hour); case 1: } this way you're not passing un-subbed i18n strings about so we don't need klocalisedstring - David ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/119738/#review64539 ----------------------------------------------------------- On Aug. 12, 2014, 6:08 p.m., Kai Uwe Broulik wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://git.reviewboard.kde.org/r/119738/ > ----------------------------------------------------------- > > (Updated Aug. 12, 2014, 6:08 p.m.) > > > Review request for Plasma. > > > Repository: kdeplasma-addons > > > Description > ------- > > This ports the infamous Fuzzy Clock to Plasma 5. > > The code is derived from digital clock with the fuzzy logic derived from the > original implementation. > > I had to substitute %1 by $1 in the i18n strings (and replace them back), > otherwise I got "I18N_EXCESSIVE_ARGUMENTS" thingies appended to my fuzzy > string. > > Missing is the ability to show the time zone (really needed here?), and the > "Percent of taskbar size" slider because that layouting logic copied from > digital clock is beyond me :) > Also missing is the "Configure time format" (why's there no "Configure Date > and Time" in digital clock?) because fuzzy clock doesn't really adhere to the > locale anyway and I didn't want to yet again duplicate that ProcessRunner > plugin which seems to have been copied all over the place already. > > > Diffs > ----- > > applets/fuzzy-clock/fuzzyClockConfig.ui 15cc658 > applets/fuzzy-clock/package/contents/config/config.qml PRE-CREATION > applets/fuzzy-clock/package/contents/config/main.xml PRE-CREATION > applets/fuzzy-clock/package/contents/ui/FuzzyClock.qml PRE-CREATION > applets/fuzzy-clock/package/contents/ui/configAppearance.qml PRE-CREATION > applets/fuzzy-clock/package/contents/ui/main.qml PRE-CREATION > applets/fuzzy-clock/package/metadata.desktop PRE-CREATION > applets/fuzzy-clock/plasma-clock-fuzzy.desktop 5f6d30b > applets/CMakeLists.txt 661ecb4 > applets/fuzzy-clock/CMakeLists.txt 1068150 > applets/fuzzy-clock/Messages.sh c8c9f06 > applets/fuzzy-clock/fuzzyClock.h 9bf5c4e > applets/fuzzy-clock/fuzzyClock.cpp 2cd189d > > Diff: https://git.reviewboard.kde.org/r/119738/diff/ > > > Testing > ------- > > I've been running it since yesterday evening and didn't notice unusual > behavior, except that due to the update interval of 30s it doesn't update > right away when session is resumed from Suspend (but I guess this is a Plasma > issue?). > > Also it tends to cut off in a vertical panel due to its (sane) minimum font > size (smallest theme font) being larger than in the original implementation > where it used to get super tiny then. > > > File Attachments > ---------------- > > In horizontal panel > > https://git.reviewboard.kde.org/media/uploaded/files/2014/08/12/35e0fea1-8a28-4ddb-9a81-9112bb85eab5__fuzzyinapanel.png > On the Desktop > > https://git.reviewboard.kde.org/media/uploaded/files/2014/08/12/a246f3b3-bb12-4756-8069-594d25bd39f6__fuzzyonthedesktop.png > Configuration UI > > https://git.reviewboard.kde.org/media/uploaded/files/2014/08/12/a144ea07-e18a-4a90-965a-3db51d91fb5d__fuzzyconfig.png > > > Thanks, > > Kai Uwe Broulik > >
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel