mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-07-30 07:28:53 +00:00
Update docs & add language code validation
This commit is contained in:
@@ -371,6 +371,7 @@ Sort an array of tiddler titles by a specified field
|
||||
*/
|
||||
exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,isNumeric,isAlphaNumeric,locale) {
|
||||
var self = this;
|
||||
locale = $tw.utils.checkLanguageCode(locale) ? locale : undefined;
|
||||
if(sortField === "title") {
|
||||
if(!isNumeric && !isAlphaNumeric) {
|
||||
if(isCaseSensitive) {
|
||||
@@ -380,7 +381,7 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is
|
||||
});
|
||||
} else {
|
||||
titles.sort(function(a,b) {
|
||||
return a.localeCompare(b);
|
||||
return a.localeCompare(b, locale);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
created: 20251001034405510
|
||||
list: A a Ä ä Z z
|
||||
modified: 20251001034911337
|
||||
list: A a Ä ä Z z I ı İ i Ö ö Ü ü
|
||||
modified: 20251107113112003
|
||||
tags:
|
||||
title: Locale Example
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -1,5 +1,5 @@
|
||||
created: 20150124112340000
|
||||
modified: 20251001034921899
|
||||
modified: 20251107113531458
|
||||
tags: [[sort Operator]] [[Operator Examples]]
|
||||
title: sort Operator (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -11,5 +11,10 @@ type: text/vnd.tiddlywiki
|
||||
<<.operator-example 3 "one two Three four +[sort[]]">>
|
||||
<<.operator-example 4 "[prefix[Tiddl]sort[text]]">>
|
||||
<<.operator-example 5 "[has[created]sort[created]limit[10]]" "the oldest 10 tiddlers in the wiki">>
|
||||
<<.operator-example 6 "[list[Locale Example]sort[],[de]]">>
|
||||
|
||||
! Using a custom locale
|
||||
The following examples shows the differences when using the sort operator with default, Swedish and Turkish locale.
|
||||
|
||||
<<.operator-example 6 "[list[Locale Example]sort[]]">>
|
||||
<<.operator-example 7 "[list[Locale Example]sort[],[sv]]">>
|
||||
<<.operator-example 8 "[list[Locale Example]sort[],[tr]]">>
|
||||
|
||||
Reference in New Issue
Block a user