Skip to content

Commit

Permalink
refactor: use more common syntax for message placeholders (#6948)
Browse files Browse the repository at this point in the history
**Related Issue:** N/A

## Summary

Using the more common `{placeholder}` syntax should help minimize
confusion with string interpolation in template literals.
  • Loading branch information
jcfranco authored Jun 30, 2023
1 parent 3e9edde commit fe2fffc
Show file tree
Hide file tree
Showing 87 changed files with 214 additions and 211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ This pattern enables components to support built-in translations. In order to su
- You can also look at the interface and util documentation for additional info.
- The internal `messages` property should be used as the source of truth for translations in rendering.
- List of supported locales can be found on our [Localization support page](https://developers.arcgis.com/calcite-design-system/localization/#locale-support).
- Placeholders in message bundle strings should:
- Use the following syntax: `{placeholder}` (e.g., `Hello {userName}, my old friend. 👋`).
- Have an expressive name to provide context regarding its use.

## Translated strings

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Rating",
"stars": "Stars: ${num}"
"stars": "Stars: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "التقييم",
"stars": "النجوم: ${num}"
"stars": "النجوم: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Оценка",
"stars": "Звезди: ${num}"
"stars": "Звезди: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Ocjena",
"stars": "Zvjezdice: ${num}"
"stars": "Zvjezdice: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Qualificació",
"stars": "Estrelles: ${num}"
"stars": "Estrelles: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Hodnocení",
"stars": "Počet hvězdiček: ${num}"
"stars": "Počet hvězdiček: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Vurdering",
"stars": "Stjerner: ${num}"
"stars": "Stjerner: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Bewertung",
"stars": "Sterne: ${num}"
"stars": "Sterne: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Αξιολόγηση",
"stars": "Αστέρια: ${num}"
"stars": "Αστέρια: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Rating",
"stars": "Stars: ${num}"
"stars": "Stars: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Calificación",
"stars": "Estrellas: ${num}"
"stars": "Estrellas: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Hinnang",
"stars": "Tärne: ${num}"
"stars": "Tärne: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Arviointi",
"stars": "Tähdet: ${num}"
"stars": "Tähdet: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Évaluation",
"stars": "Étoiles : ${num}"
"stars": "Étoiles : {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "דירוג",
"stars": "כוכבים: ${num}"
"stars": "כוכבים: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Ocjena",
"stars": "Zvjezdice: ${num}"
"stars": "Zvjezdice: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Értékelés",
"stars": "Csillagok: ${num}"
"stars": "Csillagok: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Peringkat",
"stars": "Bintang: ${num}"
"stars": "Bintang: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Valutazione",
"stars": "Stelle: ${num}"
"stars": "Stelle: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "評価",
"stars": "星: ${num}"
"stars": "星: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "평점",
"stars": "별: ${num}개"
"stars": "별: {num}개"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Vertinimas",
"stars": "Žvaigždutės ${num}"
"stars": "Žvaigždutės {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Novērtējums",
"stars": "Zvaigznes: ${num}"
"stars": "Zvaigznes: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Beoordeling",
"stars": "Sterren: ${num}"
"stars": "Sterren: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Vurdering",
"stars": "Stjerner: ${num}"
"stars": "Stjerner: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Ocena",
"stars": "Gwiazdki: ${num}"
"stars": "Gwiazdki: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Classificação",
"stars": "Estrelas: ${num}"
"stars": "Estrelas: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Avaliação",
"stars": "Estrelas: ${num}"
"stars": "Estrelas: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Calificativ",
"stars": "Stele: ${num}"
"stars": "Stele: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Рейтинг",
"stars": "Звезды: ${num}"
"stars": "Звезды: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Hodnotenie",
"stars": "Hviezdičky: ${num}"
"stars": "Hviezdičky: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Ocena",
"stars": "Zvezde: ${num}"
"stars": "Zvezde: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Ocena",
"stars": "Zvezdice: ${num}"
"stars": "Zvezdice: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Bedömning",
"stars": "Stjärnor: ${num}"
"stars": "Stjärnor: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "อันดับ",
"stars": "ดาว: ${num}"
"stars": "ดาว: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Derecelendirme",
"stars": "Yıldız: ${num}"
"stars": "Yıldız: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Рейтинг",
"stars": "Зірки: ${num}"
"stars": "Зірки: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "Xếp loại",
"stars": "Sao: ${num}"
"stars": "Sao: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "评级",
"stars": "星:${num}"
"stars": "星:{num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "評級次數",
"stars": "星星: ${num}"
"stars": "星星: {num}"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rating": "評級次數",
"stars": "星星: ${num}"
"stars": "星星: {num}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export class Rating
</div>
)}
<span class="visually-hidden">
{this.messages.stars.replace("${num}", `${value}`)}
{this.messages.stars.replace("{num}", `${value}`)}
</span>
</label>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"invalid": "Invalid",
"tooLong": "Character limit exceeded",
"longText": "The current character length is ${currentLength}, which exceeds the maximum character length of ${maxLength}."
"longText": "The current character length is {currentLength}, which exceeds the maximum character length of {maxLength}."
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"invalid": "Invalid",
"tooLong": "Character limit exceeded",
"longText": "The current character length is ${currentLength}, which exceeds the maximum character length of ${maxLength}."
"longText": "The current character length is {currentLength}, which exceeds the maximum character length of {maxLength}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "Reordering ${itemLabel}, current position ${position} of ${total}.",
"dragHandleChange": "${itemLabel}, new position ${position} of ${total}. Press space to confirm.",
"dragHandleCommit": "${itemLabel}, current position ${position} of ${total}.",
"dragHandleIdle": "${itemLabel}, press space and use arrow keys to reorder content. Current position ${position} of ${total}."
"dragHandleActive": "Reordering {itemLabel}, current position {position} of {total}.",
"dragHandleChange": "{itemLabel}, new position {position} of {total}. Press space to confirm.",
"dragHandleCommit": "{itemLabel}, current position {position} of {total}.",
"dragHandleIdle": "{itemLabel}, press space and use arrow keys to reorder content. Current position {position} of {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "إعادة ترتيب ${itemLabel}، الموضع الحالي ${position} من ${total}.",
"dragHandleChange": "${itemLabel}، الموضع الجديد ${position} من ${total} اضغط على مفتاح المسافة للتأكيد.",
"dragHandleCommit": "${itemLabel}، الموضع الحالي ${position} من ${total}.",
"dragHandleIdle": "${itemLabel}، اضغط على مفتاح المسافة واستخدام مفاتيح الأسهم لإعادة ترتيب المحتوى. الموضع الحالي ${position} من ${total}."
"dragHandleActive": "إعادة ترتيب {itemLabel}، الموضع الحالي {position} من {total}.",
"dragHandleChange": "{itemLabel}، الموضع الجديد {position} من {total} اضغط على مفتاح المسافة للتأكيد.",
"dragHandleCommit": "{itemLabel}، الموضع الحالي {position} من {total}.",
"dragHandleIdle": "{itemLabel}، اضغط على مفتاح المسافة واستخدام مفاتيح الأسهم لإعادة ترتيب المحتوى. الموضع الحالي {position} من {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "Пренареждане ${itemLabel}, текущата позиция е ${position} от ${total}.",
"dragHandleChange": "${itemLabel}, новата позиция е${position} от ${total}. Натиснете интервала за потвърждаване.",
"dragHandleCommit": "${itemLabel}, текущата позиция е ${position} от ${total}.",
"dragHandleIdle": "${itemLabel}, натиснете интервал и използвайте клавишите със стрелки, за да промените реда на съдържанието. Текущата позиция е ${position} от ${total}."
"dragHandleActive": "Пренареждане {itemLabel}, текущата позиция е {position} от {total}.",
"dragHandleChange": "{itemLabel}, новата позиция е{position} от {total}. Натиснете интервала за потвърждаване.",
"dragHandleCommit": "{itemLabel}, текущата позиция е {position} от {total}.",
"dragHandleIdle": "{itemLabel}, натиснете интервал и използвайте клавишите със стрелки, за да промените реда на съдържанието. Текущата позиция е {position} от {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "Promjena redoslijeda ${itemLabel}, trenutačni položaj ${position} od ${total}.",
"dragHandleChange": "${itemLabel}, novi položaj ${position} od ${total}. Pritisnite razmaknicu za potvrdu.",
"dragHandleCommit": "${itemLabel}, trenutačni položaj ${position} od ${total}.",
"dragHandleIdle": "${itemLabel}, pritisnite razmaknicu i upotrijebite tipke sa strelicama za promjenu redoslijeda sadržaja. Trenutačni položaj ${position} od ${total}."
"dragHandleActive": "Promjena redoslijeda {itemLabel}, trenutačni položaj {position} od {total}.",
"dragHandleChange": "{itemLabel}, novi položaj {position} od {total}. Pritisnite razmaknicu za potvrdu.",
"dragHandleCommit": "{itemLabel}, trenutačni položaj {position} od {total}.",
"dragHandleIdle": "{itemLabel}, pritisnite razmaknicu i upotrijebite tipke sa strelicama za promjenu redoslijeda sadržaja. Trenutačni položaj {position} od {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "S'està canviant l'ordre de ${itemLabel}, posició actual ${position} de ${total}.",
"dragHandleChange": "${itemLabel}, posició nova ${position} de ${total}. Premeu la tecla d'espai per confirmar-ho.",
"dragHandleCommit": "${itemLabel}, posició actual ${position} de ${total}.",
"dragHandleIdle": "${itemLabel}, premeu la tecla d'espai i feu servir les tecles de fletxa per canviar l'ordre del contingut. Posició actual ${position} de ${total}."
"dragHandleActive": "S'està canviant l'ordre de {itemLabel}, posició actual {position} de {total}.",
"dragHandleChange": "{itemLabel}, posició nova {position} de {total}. Premeu la tecla d'espai per confirmar-ho.",
"dragHandleCommit": "{itemLabel}, posició actual {position} de {total}.",
"dragHandleIdle": "{itemLabel}, premeu la tecla d'espai i feu servir les tecles de fletxa per canviar l'ordre del contingut. Posició actual {position} de {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "Změna pořadí ${itemLabel}, aktuální pozice ${position} z ${total}.",
"dragHandleChange": "${itemLabel}, nová pozice ${position} z ${total}. Potvrďte stisknutím mezerníku.",
"dragHandleCommit": "${itemLabel}, aktuální pozice ${position} z ${total}.",
"dragHandleIdle": "${itemLabel}, stiskněte mezerník a pomocí šipek změňte pořadí obsahu. Aktuální pozice ${position} z ${total}."
"dragHandleActive": "Změna pořadí {itemLabel}, aktuální pozice {position} z {total}.",
"dragHandleChange": "{itemLabel}, nová pozice {position} z {total}. Potvrďte stisknutím mezerníku.",
"dragHandleCommit": "{itemLabel}, aktuální pozice {position} z {total}.",
"dragHandleIdle": "{itemLabel}, stiskněte mezerník a pomocí šipek změňte pořadí obsahu. Aktuální pozice {position} z {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "Genbestiller ${itemLabel}, aktuel position ${position} for ${total}.",
"dragHandleChange": "${itemLabel}, ny position ${position} for ${total}. Tryk på mellemrumstasten for at bekræfte.",
"dragHandleCommit": "${itemLabel}, aktuel position ${position} for ${total}.",
"dragHandleIdle": "${itemLabel}, tryk på mellemrumstasten og brug piletasterne for at bestille indholdet igen. Aktuel position ${position} for ${total}."
"dragHandleActive": "Genbestiller {itemLabel}, aktuel position {position} for {total}.",
"dragHandleChange": "{itemLabel}, ny position {position} for {total}. Tryk på mellemrumstasten for at bekræfte.",
"dragHandleCommit": "{itemLabel}, aktuel position {position} for {total}.",
"dragHandleIdle": "{itemLabel}, tryk på mellemrumstasten og brug piletasterne for at bestille indholdet igen. Aktuel position {position} for {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "${itemLabel} wird neu angeordnet, aktuelle Position ${position} von ${total}.",
"dragHandleChange": "${itemLabel}, neue Position ${position} von ${total}. Drücken Sie zur Bestätigung die Leertaste.",
"dragHandleCommit": "${itemLabel}, aktuelle Position ${position} von ${total}.",
"dragHandleIdle": "${itemLabel}, drücken Sie die Leertaste und verwenden Sie die Pfeiltasten, um die Reihenfolge des Inhalts zu ändern. Aktuelle Position ${position} von ${total}."
"dragHandleActive": "{itemLabel} wird neu angeordnet, aktuelle Position {position} von {total}.",
"dragHandleChange": "{itemLabel}, neue Position {position} von {total}. Drücken Sie zur Bestätigung die Leertaste.",
"dragHandleCommit": "{itemLabel}, aktuelle Position {position} von {total}.",
"dragHandleIdle": "{itemLabel}, drücken Sie die Leertaste und verwenden Sie die Pfeiltasten, um die Reihenfolge des Inhalts zu ändern. Aktuelle Position {position} von {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "Αναδιάταξη ${itemLabel}, τρέχουσα θέση ${position} του ${total}.",
"dragHandleChange": "${itemLabel}, νέα θέση ${position} του ${total}. Πατήστε space για επιβεβαίωση.",
"dragHandleCommit": "${itemLabel}, τρέχουσα θέση ${position} του ${total}.",
"dragHandleIdle": "${itemLabel}, πατήστε space και χρησιμοποιήστε τα βέλη για να αναδιατάξετε το περιεχόμενο. Τρέχουσα θέση ${position} του ${total}."
"dragHandleActive": "Αναδιάταξη {itemLabel}, τρέχουσα θέση {position} του {total}.",
"dragHandleChange": "{itemLabel}, νέα θέση {position} του {total}. Πατήστε space για επιβεβαίωση.",
"dragHandleCommit": "{itemLabel}, τρέχουσα θέση {position} του {total}.",
"dragHandleIdle": "{itemLabel}, πατήστε space και χρησιμοποιήστε τα βέλη για να αναδιατάξετε το περιεχόμενο. Τρέχουσα θέση {position} του {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "Reordering ${itemLabel}, current position ${position} of ${total}.",
"dragHandleChange": "${itemLabel}, new position ${position} of ${total}. Press space to confirm.",
"dragHandleCommit": "${itemLabel}, current position ${position} of ${total}.",
"dragHandleIdle": "${itemLabel}, press space and use arrow keys to reorder content. Current position ${position} of ${total}."
"dragHandleActive": "Reordering {itemLabel}, current position {position} of {total}.",
"dragHandleChange": "{itemLabel}, new position {position} of {total}. Press space to confirm.",
"dragHandleCommit": "{itemLabel}, current position {position} of {total}.",
"dragHandleIdle": "{itemLabel}, press space and use arrow keys to reorder content. Current position {position} of {total}."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dragHandleActive": "Reordenamiento de ${itemLabel} , posición actual ${position} de ${total}.",
"dragHandleChange": "${itemLabel}, nueva posición ${position} de ${total}. Presione la barra espaciadora para confirmar.",
"dragHandleCommit": "${itemLabel}, posición actual ${position} de ${total}.",
"dragHandleIdle": "${itemLabel}, presione la barra espaciadora y utilice las teclas de flecha para reordenar el contenido. Posición actual ${position} de ${total}."
"dragHandleActive": "Reordenamiento de {itemLabel} , posición actual {position} de {total}.",
"dragHandleChange": "{itemLabel}, nueva posición {position} de {total}. Presione la barra espaciadora para confirmar.",
"dragHandleCommit": "{itemLabel}, posición actual {position} de {total}.",
"dragHandleIdle": "{itemLabel}, presione la barra espaciadora y utilice las teclas de flecha para reordenar el contenido. Posición actual {position} de {total}."
}
Loading

0 comments on commit fe2fffc

Please sign in to comment.