Skip to content

Adding Urdu Language Support to the p5.js Web Editor #2633

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

Closed
ayeshag7 opened this issue Nov 23, 2023 · 8 comments · Fixed by #2741
Closed

Adding Urdu Language Support to the p5.js Web Editor #2633

ayeshag7 opened this issue Nov 23, 2023 · 8 comments · Fixed by #2741
Assignees
Labels
Area: Translation For localization of the p5.js editor or contributor documentation Enhancement Improvement to an existing feature

Comments

@ayeshag7
Copy link
Contributor

Increasing Access

Adding Urdu language support to the p5.js Web Editor will help improve its accessibility by making it more inclusive for Urdu speakers, and facilitating easier learning for them. It'll also help expand our current user base and foster more community engagement.

Feature enhancement details

Currently, the p5.js Web Editor lacks support for Urdu language, leaving out a considerably large community of Urdu speakers who could benefit from its presence. Allowing users to interact with the editor in their native language can significantly elevate their learning capabilities and overall experience. This feature enhancement can make it possible for Urdu speakers. I would like to initiate a discussion about this matter and, if possible, work on its addition myself.

@ayeshag7 ayeshag7 added the Enhancement Improvement to an existing feature label Nov 23, 2023
Copy link

welcome bot commented Nov 23, 2023

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

@ayeshag7
Copy link
Contributor Author

@lindapaiste Can you please assess this issue and let me know whether we should work on including it to the editor or not?

@lindapaiste lindapaiste added the Area: Translation For localization of the p5.js editor or contributor documentation label Nov 28, 2023
@ayeshag7
Copy link
Contributor Author

ayeshag7 commented Dec 2, 2023

@lindapaiste If you think that Urdu language support is something that we should add to the web editor, then I request you to assign this issue to me, and I'll start work on it right away.

@ayeshag7
Copy link
Contributor Author

@lindapaiste Hi, I had completed all the translations to Urdu, however, I ran into a problem regarding the 'date-fns' library. Currently, date-fns doesn't provide support for Urdu language. This means that I couldn't import it to use in the export function languageKeyToDateLocale(lang) {}.

Importing ur from date-fn/locale generates this warning in the console when executing a sketch:

export 'ur' (imported as 'ur') was not found in 'date-fns/locale' (possible exports: af, arDZ, arMA, arSA, az, be, bg, bn, ca, cs, cy, da, de, deAT, el, enAU, enCA, enGB, enIN, enNZ, enUS, enZA, eo, es, et, eu, faIR, fi, fr, frCA, frCH, gd, gl, gu, he, hi, hr, ht, hu, hy, id, is, it, ja, ka, kk, kn, ko, lb, lt, lv, mk, mn, ms, mt, nb, nl, nlBE, nn, pl, pt, ptBR, ro, ru, sk, sl, sq, sr, srLatn, sv, ta, te, th, tr, ug, uk, uz, vi, zhCN, zhTW)

Even though the rest of the functionality of the p5.js web editor was not affected, I suspect that it would cause a problem when there's a need to translate times and dates with Urdu language selected.

One possible solution can be to implement logic to set enUS as the fallback for translating times and dates when Urdu language is selected.

Another solution is to implement custom logic for translating times and dates into Urdu language in a separate file and then importing it. Possibly like:

import { format } from 'date-fns';

// Defining custom date formatting rules for Urdu
const urduLocale = {
  months: [
    'جنوری',
    'فروری',
    'مارچ',
    'اپریل',
    'اکتوبر',
    'نومبر',
    'دسمبر',
  ],
  weekdays: [
    'اتوار',
    'پیر',
    'منگل',
    'بدھ',
    'جمعرات',
    'جمعہ',
    'ہفتہ',
  ],
  // More rules here
};

// A function to format a date using the custom Urdu locale
export function formatUrduDate(date, formatString) {
  return format(date, formatString, { locale: urduLocale });
}

export default urduLocale;

I would be grateful if you can guide me about what to do about this problem. Which would be the best route to take in your opinion?

Thanks.

@lindapaiste
Copy link
Collaborator

@lindapaiste Hi, I had completed all the translations to Urdu, however, I ran into a problem regarding the 'date-fns' library. Currently, date-fns doesn't provide support for Urdu language. This means that I couldn't import it to use in the export function languageKeyToDateLocale(lang) {}.

Wow, it's kind of wild that date-fns doesn't support Urdu but it seems like they don't! There is an en-IN option for English/India which would be better than en-US. We can use that to get started. Meaning that we can still add Urdu support to editor even if there's not 100% coverage of everything.

This might be a pain, but I think that the ideal approach for you writing a formatting function would be for you to put in a PR with date-fns to get it added to their repo.

@ayeshag7
Copy link
Contributor Author

Thanks for your help @lindapaiste. I was stuck on this for quite a while. For now, I'll submit a PR with the en-IN as a fallback for Urdu Language, and also work on submitting a PR to date-fns to include Urdu language support.

@ayeshag7
Copy link
Contributor Author

Hi, @lindapaiste. I've opened a pull request for this issue. Kindly review it. Thanks.

@ayeshag7
Copy link
Contributor Author

ayeshag7 commented Jan 2, 2024

Hello, @lindapaiste, my pull request linking this issue still hasn't been reviewed by any of the maintainers. I was wondering whether I missed some step in the process, or there's another workflow that I'm not aware of? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Translation For localization of the p5.js editor or contributor documentation Enhancement Improvement to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants