Edit

Share via


Quickstart: Localization & Formatting Helper (Preview)

GitHub Copilot helps developers build globally aware applications by addressing localization and formatting needs directly within SQL and ORM-based workflows. Whether you're working with multilingual content, region-specific date and number formats, or collation settings for search and sorting, GitHub Copilot provides intelligent, context-aware assistance to make your database and code ready for international users.

Get started

Ensure that you're connected to a database and have an active editor window open with the MSSQL extension. This connection allows the @mssql chat participant to understand the context of your database environment, enabling accurate and context-aware suggestions. Without a database connection, the chat participant won't have the schema or data context to provide meaningful responses.

The following examples use the AdventureWorksLT2022 sample database, which you can download from the Microsoft SQL Server Samples and Community Projects home page.

For best results, adjust table and schema names to match your own environment.

Make sure the chat includes the @mssql prefix. For example, type @mssql followed by your question or prompt. This ensures that the chat participant understands you're asking for SQL-related assistance.

Handle localization and formatting with GitHub Copilot

GitHub Copilot can assist with localization and formatting tasks in SQL and ORM-based workflows. It can help you design schemas that support multilingual content, format queries for regional standards, and generate code that adheres to localization best practices.

Here are common use cases and examples of what you can ask via the chat participant:

Optimize multilingual and locale-specific data

Use GitHub Copilot to help with formatting queries for regional standards, choosing the right collation settings, and designing schema elements to support multilingual content, like storing product descriptions in multiple languages.

  • Design a localized table to store product descriptions for the SalesLT.Product table. Ensure the table supports multiple languages, includes a relationship to SalesLT.Product, and allows for efficient querying.

  • Format a query to display dates in Japanese format:

SELECT FORMAT(GETDATE(), 'yyyy/MM/dd') AS CurrentDate;
  • Recommend best practices for choosing collation settings when supporting multilingual user input and search functionality in SQL Server.

  • Write Prisma models and queries to store and retrieve multilingual product descriptions for the SalesLT.Product table in my database. Ensure the schema supports multiple languages, maintains a foreign key relationship with SalesLT.Product, and allows for efficient querying of localized descriptions.

Code-first localization scenarios

These examples show how GitHub Copilot supports code-first workflows by generating ORM models and queries that store and retrieve localized data. The examples span popular ORMs like Prisma, SQLAlchemy, Entity Framework, Sequelize, and Django.

  • Using Entity Framework Core, define a model for ProductDescriptionLocalized that maps to multiple languages and relates to SalesLT.Product. Include logic to filter by language code.

  • In Prisma, generate a schema that supports localized descriptions for SalesLT.Product, and write a query to retrieve the description for a given product in Spanish (es).

  • With Sequelize, create a localized table for storing product descriptions with ProductID, LanguageCode, and Description. Write a query to return the Japanese description if available, otherwise fall back to the default language.

  • Using SQLAlchemy, write a function that retrieves the localized name and description for a given ProductID based on a user-specified locale, with fallback logic to default language.

  • In Django ORM, design models that support product localization and write a query to retrieve all products with their name and description in French (fr), including any missing translations as NULL.

Feedback: Localization & Formatting Helper

To help us refine and improve GitHub Copilot for the MSSQL extension, use the following GitHub issue template to submit your feedback: GitHub Copilot Feedback

When submitting feedback, consider including:

  • Scenarios tested – Let us know which areas you focused on, for example, schema creation, query generation, security, localization.

  • What worked well – Describe any experiences that felt smooth, helpful, or exceeded your expectations.

  • Issues or bugs – Include any problems, inconsistencies, or confusing behaviors. Screenshots or screen recordings are especially helpful.

  • Suggestions for improvement – Share ideas for improving usability, expanding coverage, or enhancing the GitHub Copilot's responses.