[openstreetmap/openstreetmap-website] display warning in new note form after too many anonymous notes (PR #5468)

etiennejourdier notifications at github.com
Sun Jan 5 23:06:02 UTC 2025


@etiennejourdier commented on this pull request.



> @@ -152,6 +152,16 @@ OSM.NewNote = function (map) {
       .on("input", updateControls)
       .focus();
 
+    var anonymousNotesCount = Number(localStorage.getItem("anonymousNotesCount"));
+
+    if (typeof OSM.user === "undefined" && anonymousNotesCount >= 20) {
+      var counterWarning = content.find("#new-note-counter-warning");
+      if (typeof counterWarning.html() !== "undefined") {
+        counterWarning.html(counterWarning.html().replace("(N)", anonymousNotesCount));

OK I understood how pluralization works with i18n, but it is server-side ... If the value of the counter is in the browser (whether in a cookie or in localStorage), it has to be inserted by jquery, so after the translation, and it's too late to manage the different plurals, right ? Is there another option to manage plurals with jquery ? Or is it why you propose the counter to be server-side ?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5468#discussion_r1903357181
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5468/review/2530981843 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250105/af829c9b/attachment.htm>


More information about the rails-dev mailing list