Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added i18n support for Thai #1029

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

icodeforlove
Copy link

Checklist

  • All new and existing tests are passing
  • (If adding features:) I have added tests to cover my changes
  • (If docs changes needed:) I have updated the documentation accordingly.
  • I have added an entry to CHANGES.rst because this is a user-facing change or an important bugfix
  • I have written proper commit message(s)

What changes does this Pull Request introduce?

...

Why is this necessary?

...

@ix5 ix5 added client (Javascript) client code and CSS improvement Not a new feature, but makes Isso more pleasant to use labels Jun 30, 2024
@ix5 ix5 added this to the 0.13.1 milestone Jun 30, 2024
@ix5
Copy link
Member

ix5 commented Jun 30, 2024

Hey, thank you for contributing! You may have noticed that your code currently does nothing.

You have to add the Thai translation .js file to the translation list inside i18n.js and state which kind of plural form describes the Thai language most accurately.

By plural form we mean that depending on the count of a thing, the grammar also slightly changes.

For English, this would be:

  • 0 apples
  • One apple
  • 2 apples
  • 3 apples
  • ... and so forth

Meaning that for a count of 0 and everything above 1, we say "apples", and only for 1, we say "apple". In code, this would be n !== 1 for the plural form and n === 1 for the singular form.

Here are two resources which might help:

Here is my suggestion for you (you need to figure out where the correct pluralforms yourself):

diff --git a/isso/js/app/i18n.js b/isso/js/app/i18n.js
index 2579408..30a1632 100644
--- a/isso/js/app/i18n.js
+++ b/isso/js/app/i18n.js
@@ -28,6 +28,7 @@ var catalogue = {
     ru:      require("app/i18n/ru"),
     sk:      require("app/i18n/sk"),
     sv:      require("app/i18n/sv"),
+    th:      require("app/i18n/th"),
     tr:      require("app/i18n/tr"),
     uk:      require("app/i18n/uk"),
     vi:      require("app/i18n/vi"),
@@ -58,6 +59,7 @@ var pluralforms = function(lang) {
     case "nl":
     case "pt":
     case "sv":
+    case "th":
     case "tr":
     case "vi":
     case "zh":

For testing:

diff --git a/isso/demo/index.html b/isso/demo/index.html
index 1577253..cb4788d 100644
--- a/isso/demo/index.html
+++ b/isso/demo/index.html
@@ -11,6 +11,7 @@
 
    <script src="../js/embed.dev.js"
            data-isso="../"
+           data-isso-lang="th"
            ></script>
    <!-- Uncomment to only test count functionality: -->
    <!-- <script src="../js/count.dev.js"></script> -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client (Javascript) client code and CSS improvement Not a new feature, but makes Isso more pleasant to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants