Skip to content

Conversation

@Vidhan-59
Copy link

No description provided.

@Vidhan-59 Vidhan-59 marked this pull request as draft October 31, 2025 16:30
@Vidhan-59 Vidhan-59 marked this pull request as ready for review October 31, 2025 16:31
Extract translation strings from your components:

```bash
lingo extract
Copy link
Contributor

Choose a reason for hiding this comment

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

The CLI commands in this guide appear to have been hallucinated by AI. Please manually review the guide and verify each of the steps. Thanks. 😄

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a comprehensive Tauri integration guide that demonstrates how to use Lingo.dev CLI to build multilingual desktop applications. The guide walks developers through setting up a Tauri + React project with internationalization support using react-intl.

Key changes:

  • Comprehensive step-by-step guide covering project setup, Lingo.dev CLI integration, and react-intl configuration
  • Code examples for IntlProvider setup, language switching, and translation workflow
  • Advanced section on accessing system locale from Rust backend

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +135 to +145
export const useChangeLocale = () => {
const [locale, setLocale] = useState<string>('en');

const changeLocale = async (newLocale: string) => {
const messages = await loadMessages(newLocale);
setLocale(newLocale);
return messages;
};

return { locale, changeLocale };
};
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The useChangeLocale hook maintains its own local state that is not synchronized with the IntlProvider component's state. This hook will not actually change the locale in the application since it doesn't update the IntlProvider's state. This hook is also never used elsewhere in the guide. Either remove it or implement a proper context-based locale switching mechanism using React Context API.

Suggested change
export const useChangeLocale = () => {
const [locale, setLocale] = useState<string>('en');
const changeLocale = async (newLocale: string) => {
const messages = await loadMessages(newLocale);
setLocale(newLocale);
return messages;
};
return { locale, changeLocale };
};

Copilot uses AI. Check for mistakes.
Comment on lines +278 to +282
// Reload the page to apply new locale
window.location.reload();

// Store preference for next session
localStorage.setItem('locale', newLocale);
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The code stores the locale in localStorage after calling window.location.reload(), but the reload will prevent the localStorage.setItem call from executing. The localStorage operation should be performed before the reload.

Suggested change
// Reload the page to apply new locale
window.location.reload();
// Store preference for next session
localStorage.setItem('locale', newLocale);
// Store preference for next session
localStorage.setItem('locale', newLocale);
// Reload the page to apply new locale
window.location.reload();

Copilot uses AI. Check for mistakes.
Comment on lines +277 to +282
setLocale(newLocale);
// Reload the page to apply new locale
window.location.reload();

// Store preference for next session
localStorage.setItem('locale', newLocale);
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The setLocale(newLocale) call before window.location.reload() has no effect since the page reloads immediately after. This call should be removed as it creates confusion about the execution flow.

Suggested change
setLocale(newLocale);
// Reload the page to apply new locale
window.location.reload();
// Store preference for next session
localStorage.setItem('locale', newLocale);
// Store preference for next session
localStorage.setItem('locale', newLocale);
// Reload the page to apply new locale
window.location.reload();

Copilot uses AI. Check for mistakes.
```rust
#[tauri::command]
fn get_system_locale() -> String {
sys_locale::get_locale().unwrap_or_else(|| String::from("en"))
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The function returns the full locale string from sys_locale::get_locale() which may include region codes (e.g., 'en-US'), but the guide's supported locales only use language codes ('en', 'es', 'fr', 'de'). The function should extract just the language code part (e.g., split on '-' and take the first part) to match the pattern used in the JavaScript code on line 114.

Suggested change
sys_locale::get_locale().unwrap_or_else(|| String::from("en"))
sys_locale::get_locale()
.and_then(|locale| locale.split(['-', '_'].as_ref()).next().map(|s| s.to_string()))
.unwrap_or_else(|| String::from("en"))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants