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

feat(theme-translations): default translations for Slovenian (sl-SI) #8541

Merged
merged 13 commits into from Jan 19, 2023

Conversation

MatijaSi
Copy link
Contributor

Pre-flight checklist

@facebook-github-bot
Copy link
Contributor

Hi @MatijaSi!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@netlify
Copy link

netlify bot commented Jan 11, 2023

[V2]

Name Link
🔨 Latest commit 5c4ea10
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/63c9714133ffc50008e4128c
😎 Deploy Preview https://deploy-preview-8541--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Jan 11, 2023

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🔴 18 🟢 97 🟢 92 🟢 100 🟢 90 Report
/docs/installation 🟠 62 🟢 100 🟢 92 🟢 100 🟢 90 Report

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 11, 2023
Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution. Could you take a look at https://github.com/facebook/docusaurus/tree/main/packages/docusaurus-theme-translations for instructions on how to create translations? Your generated JSON should look like https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-theme-translations/locales/ar/plugin-ideal-image.json, without the description fields.

@Josh-Cena Josh-Cena added the pr: new feature This PR adds a new API or behavior. label Jan 17, 2023
@Josh-Cena Josh-Cena changed the title Default translations for Slovenian (sl-SI) feat(theme-translations): default translations for Slovenian (sl-SI) Jan 17, 2023
Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, almost looks good.

I removed the useless __DESCRIPTION fields from your PR.

The plural forms are wrong, they should only contain 4 values instead of 5.

function getLocalePluralForms(locale) {
  const AllPluralForms = ['zero','one','two','few','many','other']
  const pluralCategories = new Intl.PluralRules(locale).resolvedOptions().pluralCategories;
  pluralCategories.sort((c1,c2) => AllPluralForms.indexOf(c1) > AllPluralForms.indexOf(c2) ? 1 : -1);
  return pluralCategories;
}

const myLocale = "sl"; // Change this variable!
console.log("Plural forms for this locale are =>>> ",getLocalePluralForms(myLocale)); 
Plural forms for this locale are =>>>  (4) ['one', 'two', 'few', 'other']

Unfortunately I don't speak sl and can't fix the existing forms 😅


You can get more info about plural forms here:
#3526

Also refer to this table:

https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html

CleanShot 2023-01-19 at 15 25 22@2x


Can't be sure but my intuition is that you should merge the 3rd and 4th plural forms because they all use the same suffix for 3 and 4 quantities: "{count} prispevki" / "{count} minute branja" / "{count} dokumenti imajo oznako" / "{count} dokumenti najdeni"

  "theme.blog.post.plurals": "En prispevek|Dva prispevka|{count} prispevki|{count} prispevkov",

Please confirm and/or update your pr

"theme.blog.post.paginator.navAriaLabel": "Navigacija prispevka na blogu",
"theme.blog.post.paginator.newerPost": "Novejši prispevek",
"theme.blog.post.paginator.olderPost": "Starejši prispevek",
"theme.blog.post.plurals": "En prispevek|Dva prispevka|Trije prispevki|Štirje prispevki|{count} prispevkov",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should only have 4 plural forms

"theme.blog.post.plurals": "En prispevek|Dva prispevka|Trije prispevki|Štirje prispevki|{count} prispevkov",
"theme.blog.post.readMore": "Preberite več",
"theme.blog.post.readMoreLabel": "Preberite več o {title}",
"theme.blog.post.readingTime.plurals": "Minuta branja|Minuti branja|Tri minute branja|Štiri minute branja|{readingTime} minut branja",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

"theme.docs.sidebar.navAriaLabel": "Stranska vrstica dokumentacije",
"theme.docs.sidebar.toggleSidebarButtonAriaLabel": "Preklopi navigacijsko vrstico",
"theme.docs.tagDocListPageTitle": "{nDocsTagged} ima oznako \"{tagName}\"",
"theme.docs.tagDocListPageTitle.nDocsTagged": "En dokument ima oznako|Dva dokumenta imata oznako|Trije dokumenti imajo oznako|Štirje dokumenti imajo oznako|{count} dokumentov ima oznako",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

"theme.SearchModal.startScreen.removeRecentSearchButtonTitle": "Umakni iskanje iz zgodovine",
"theme.SearchModal.startScreen.saveRecentSearchButtonTitle": "Shrani to iskanje",
"theme.SearchPage.algoliaLabel": "Iskanje Algolia",
"theme.SearchPage.documentsFound.plurals": "Dokument najden|Dokumenta najdena|Trije dokumenti najdeni|Štirje dokumenti najdeni|{count} dokumentov najdenih",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@slorber
Copy link
Collaborator

slorber commented Jan 19, 2023

Going to move on and apply my suggestion. Feel free to open another pr if I was wrong

@MatijaSi
Copy link
Contributor Author

MatijaSi commented Jan 19, 2023

@slorber

Slovenian has 4 plural forms, however until when we reach number 5 verb "imeti" refers to documents, while after (ex. "5 dokumentov ima") "imeti" verb doesn't refer anymore to "dokumentov", but to "5" (so it goes back to singular form). So we need to cover 5 distinct cases.

@slorber
Copy link
Collaborator

slorber commented Jan 19, 2023

@MatijaSi our pluralization system is based in the Intl apis and those API return only 4 cases, so even if you provide a 5th label, it will never be used by Docusaurus.

Docusaurus selects the string part to use according to the plural rule returned.

CleanShot 2023-01-19 at 17 47 00@2x

I don't really understand what you say above 😅

The string parts are not related to the number of documents, but the position of the plural form in that array: ['one', 'two', 'few', 'other']

If n >= 5 in sl is the "other" plural form, it should be the 4th string part of the translation string and not the 5th part. Hope it's clearer?

@slorber
Copy link
Collaborator

slorber commented Jan 19, 2023

This "other" plural form for numbers >= 5 should appear in 4th position in our translation string because it's the 4th plural form in that table.

CleanShot 2023-01-19 at 17 51 13@2x

Does it make sense?

@MatijaSi
Copy link
Contributor Author

Thank you for explanation, it makes sense.

If only 4 plurals are available I need to change translation, give me 20 minutes.

Point is that, for example "One doc tagged|{count} docs tagged" can be translated two ways. One is "Dokument ima oznako" (document has tag), which is more idiomatic, while other is "Dokument z oznako" (document with tag).

Problem is that first requires 5 variations based on number of documents (since when we reach number 5 subject of verb has to change, which changes verb). Second only requires 4 variations (singular, double, few, many) so I will change to it.

Thanks!

@MatijaSi
Copy link
Contributor Author

Eh sorry, I misremembered. 5c4ea10 is okay. I thought "Štirje dokumentje" was used for fourth case, not "štirje dokumenti". Both are correct, with second having advantage that only four variations are present.

@slorber
Copy link
Collaborator

slorber commented Jan 19, 2023

great, thanks ;)

@slorber slorber added the to backport This PR is planned to be backported to a stable version of Docusaurus label Jan 19, 2023
@slorber slorber merged commit c32316e into facebook:main Jan 19, 2023
slorber added a commit that referenced this pull request Jan 26, 2023
…8541)

Co-authored-by: Matija Sirk <matija.sirk@kopit.si>
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
@slorber slorber added backported This PR has been backported to a stable version of Docusaurus and removed to backport This PR is planned to be backported to a stable version of Docusaurus labels Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported This PR has been backported to a stable version of Docusaurus CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants