Skip to content

translated_month_name

translated_month_name(date, language)

Description

Get translated_month_name in targeted language

language has locale format such as fr, fr_FR, fr_BE, etc.

Usage

Call or Deploy translated_month_name ?
Call translated_month_name directly

The easiest way to use bigfunctions

  • translated_month_name function is deployed in 39 public datasets for all of the 39 BigQuery regions.
  • It can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
  • (You need to use the dataset in the same region as your datasets otherwise you may have a function not found error)

Public BigFunctions Datasets

Region Dataset
eu bigfunctions.eu
us bigfunctions.us
europe-west1 bigfunctions.europe_west1
asia-east1 bigfunctions.asia_east1
... ...
Deploy translated_month_name in your project

Why deploy?

  • You may prefer to deploy translated_month_name in your own project to build and manage your own catalog of functions.
  • This is particularly useful if you want to create private functions (for example calling your internal APIs).
  • Get started by reading the framework page

Deployment

translated_month_name function can be deployed with:

pip install bigfunctions
bigfun get translated_month_name
bigfun deploy translated_month_name

Examples

select bigfunctions.eu.translated_month_name(2022-05-01, "es")
select bigfunctions.us.translated_month_name(2022-05-01, "es")
select bigfunctions.europe_west1.translated_month_name(2022-05-01, "es")
+-----------------------+
| translated_month_name |
+-----------------------+
| mayo                  |
+-----------------------+

Use cases

A company has a table of sales data with a date column. They want to create a report that displays the month name in different languages based on the user's locale. They can use the translated_month_name function to achieve this.

Example Scenario:

The company operates in France and Spain. They have a BigQuery table called sales with columns date and sales_amount.

CREATE OR REPLACE TABLE `your_project.your_dataset.sales` AS
SELECT DATE('2023-01-15') AS date, 1200 AS sales_amount UNION ALL
SELECT DATE('2023-02-20') AS date, 1500 AS sales_amount UNION ALL
SELECT DATE('2023-03-10') AS date, 1800 AS sales_amount UNION ALL
SELECT DATE('2023-04-05') AS date, 1100 AS sales_amount;

Query for French Users:

SELECT
    bigfunctions.eu.translated_month_name(date, 'fr') AS month_name_fr,
    sales_amount
FROM
    `your_project.your_dataset.sales`;

Result:

month_name_fr sales_amount
janvier 1200
février 1500
mars 1800
avril 1100

Query for Spanish Users:

SELECT
    bigfunctions.eu.translated_month_name(date, 'es') AS month_name_es,
    sales_amount
FROM
    `your_project.your_dataset.sales`;

Result:

month_name_es sales_amount
enero 1200
febrero 1500
marzo 1800
abril 1100

This allows the company to generate reports tailored to different language preferences without needing complex case statements or separate tables for each language. The translated_month_name function simplifies the process of localizing date information. Remember to replace your_project.your_dataset and the region prefix (e.g. eu, us) as needed.


Need help or Found a bug?
Get help using translated_month_name

The community can help! Engage the conversation on Slack

We also provide professional suppport.

Report a bug about translated_month_name

If the function does not work as expected, please

  • report a bug so that it can be improved.
  • or open the discussion with the community on Slack.

We also provide professional suppport.


Show your ❤ by adding a ⭐ on