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 Finnish Localization for UI #753

Merged
merged 3 commits into from
Nov 2, 2024
Merged

Conversation

thahertech
Copy link
Contributor

@thahertech thahertech commented Oct 27, 2024

Description

#752

This pull request introduces Finnish localization to the project. By adding Finnish to the locales, users can interact with the application in Finnish, providing a more accessible and native experience for Finnish-speaking users. ;)

Checklist

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Introduced Finnish localization for the file uploader module, enhancing accessibility for Finnish-speaking users with translated prompts, error messages, and action labels.
    • Updated the language support to include Finnish in the application, replacing Portuguese in the language list.

Copy link
Contributor

coderabbitai bot commented Oct 27, 2024

Walkthrough

A new JavaScript file has been added to provide Finnish localization for the file uploader module. This file includes an object that maps user interface element identifiers to their Finnish translations, covering prompts, error messages, and user actions. It also incorporates pluralization rules and accessibility labels to enhance user experience. The file concludes without a newline.

Changes

File Path Change Summary
locales/file-uploader/fi.js Added a new file for Finnish localization, containing translations for UI elements, error messages, and actions.
test-locales.js Updated the SOCIAL_SOURCE_LANGS constant to include fi (Finnish) instead of pt (Portuguese).

Possibly related issues

Poem

🐰 In the land of snow and pine,
A file uploader now shines fine.
With Finnish words, so clear and bright,
Users can upload with pure delight!
"Lataa tiedosto," they cheer with glee,
A friendly interface for you and me! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (1)
locales/file-uploader/fi.js (1)

1-119: Consider adding JSDoc comments for documentation.

While the translations are clear, adding JSDoc comments would help document the purpose of this locale file and any special considerations for Finnish translations.

Add documentation at the start of the file:

+/**
+ * Finnish (fi) localization for the file uploader.
+ * Includes translations for UI elements, error messages, and accessibility labels.
+ * Follows Finnish language pluralization rules.
+ */
 export default {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c8035a4 and 80850b7.

📒 Files selected for processing (1)
  • locales/file-uploader/fi.js (1 hunks)
🔇 Additional comments (5)
locales/file-uploader/fi.js (5)

1-3: LGTM: Basic configuration is properly set up.

The locale configuration is correctly defined with 'fi' as the identifier.


39-42: Review interpolation syntax in header messages.

The interpolation syntax using {{count}} and {{plural:file(count)}} appears correct. However, let's verify this matches the expected format across other language files.

#!/bin/bash
# Check header message patterns across language files
rg -g 'locales/file-uploader/*.js' "'header-uploading'|'header-failed'|'header-succeed'|'header-total'" -A 1

111-113: Review accessibility message interpolation.

The accessibility messages for filters, crop, and tuning use consistent interpolation with {{name}}. Let's verify this matches the implementation in other languages.

#!/bin/bash
# Check accessibility message patterns
rg -g 'locales/file-uploader/*.js' "'a11y-cloud-editor-apply-" -A 1

35-38: Verify pluralization rules implementation.

The pluralization rules for 'file' and 'error' look correct in Finnish. Let's verify the implementation matches other languages.

✅ Verification successful

Pluralization rules for Finnish match common patterns across languages

The Finnish pluralization rules for 'file' and 'error' follow the correct pattern seen across other languages that have singular/plural forms. The implementation:

  • file__one: 'tiedosto' (singular) and file__other: 'tiedostot' (plural)
  • error__one: 'virhe' (singular) and error__other: 'virheitä' (plural)

matches the structure used in other languages like English, German, French, etc., where __one and __other suffixes are consistently used to distinguish between singular and plural forms.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check pluralization patterns across language files
rg -g 'locales/file-uploader/*.js' "file__one|file__other|error__one|error__other" -A 1

Length of output: 11666


Script:

#!/bin/bash
# Let's try a different approach to check pluralization patterns
rg -g 'locales/file-uploader/*.js' "file__one|file__other|error__one|error__other" --no-filename

Length of output: 3412


4-8: Verify pluralization consistency for file-related actions.

The translations correctly handle singular/plural forms for file upload and selection actions. However, let's verify the consistency with other language files.

✅ Verification successful

Pluralization is consistently implemented across all language files

The verification shows that all language files properly handle singular/plural forms for file upload and selection actions. Each language maintains the distinction between single file operations ('upload-file', 'choose-file') and multiple file operations ('upload-files', 'choose-files'), following their respective language conventions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check pluralization patterns across other language files
rg -g 'locales/file-uploader/*.js' "'upload-file'|'upload-files'|'choose-file'|'choose-files'" -A 1

Length of output: 11666


Script:

#!/bin/bash
# Let's try the correct pattern to search for file-related translations
rg -g 'locales/file-uploader/*.js' "'upload-file'|'upload-files'|'choose-file'|'choose-files'|'drop-files'" --no-filename

Length of output: 4941

locales/file-uploader/fi.js Outdated Show resolved Hide resolved
locales/file-uploader/fi.js Outdated Show resolved Hide resolved
locales/file-uploader/fi.js Outdated Show resolved Hide resolved
@egordidenko egordidenko self-requested a review November 1, 2024 11:39
@egordidenko
Copy link
Contributor

@thahertech good job. Thanks again for adding a new locale for File Uploader.

Please add id locale to the file, for successful tests.

@thahertech
Copy link
Contributor Author

@thahertech good job. Thanks again for adding a new locale for File Uploader.

Please add id locale to the file, for successful tests.

@egordidenko thanks for the reply! I have added it now.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
test-locales.js (1)

6-6: Consider improving array readability.

The array contains 15 language codes in a single line. For better maintainability and readability, consider formatting the array with one language code per line.

-const SOCIAL_SOURCE_LANGS = ['de', 'en', 'es', 'fr', 'fi', 'he', 'it', 'nl', 'pl', 'pt', 'ru', 'tr', 'uk', 'zh-TW', 'zh'];
+const SOCIAL_SOURCE_LANGS = [
+  'de',
+  'en',
+  'es',
+  'fr',
+  'fi',
+  'he',
+  'it',
+  'nl',
+  'pl',
+  'pt',
+  'ru',
+  'tr',
+  'uk',
+  'zh-TW',
+  'zh'
+];
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a489cb6 and 25c6620.

📒 Files selected for processing (1)
  • test-locales.js (1 hunks)
🔇 Additional comments (1)
test-locales.js (1)

6-6: Verify Finnish locale file existence.

Since we're adding 'fi' to the supported languages, let's verify that the corresponding Finnish locale file exists and contains all required translations.

✅ Verification successful

Finnish locale file is properly implemented and complete

The Finnish locale file exists at locales/file-uploader/fi.js and contains a comprehensive set of translations for all UI elements, including:

  • Basic actions (upload, cancel, done)
  • File handling messages
  • Camera and image editing features
  • Error messages and validation texts
  • Accessibility labels
  • Plural forms support

The implementation is consistent with other locale files in the same directory and contains all required translations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Finnish locale file existence and structure

# Check if Finnish locale file exists
echo "Checking for Finnish locale file..."
fd -t f "fi.js" locales

# Verify the structure of Finnish translations
echo "Checking Finnish locale structure..."
rg -A 5 "export default {" locales | grep -A 5 "fi\.js"

Length of output: 369


Script:

#!/bin/bash
# Let's verify the Finnish locale file content more accurately
echo "Checking Finnish locale file content..."
cat locales/file-uploader/fi.js

# Let's also check what other locale files exist in the same directory
echo -e "\nListing all locale files in file-uploader directory..."
ls -la locales/file-uploader/

# Check if Finnish locale exists in other locale directories
echo -e "\nSearching for other Finnish locale files..."
fd "fi.js" .

Length of output: 7069

@egordidenko egordidenko merged commit d6aecca into uploadcare:main Nov 2, 2024
1 check passed
@egordidenko
Copy link
Contributor

@thahertech good. Thanks again 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants