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

Set up json for tradional chinese and english. #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mariomui
Copy link

@mariomui mariomui commented Jul 6, 2023

  • Locales have two dictionaries, one for english, one for traditional chinese.

    • I am also available to do the simplified if necessary.
  • The naming system(for the dictionaries) used will be based on https://github.com/mgmeyers/obsidian-kanban/blob/05e43e09100f8c8efd7a4cd5ccb391b850e65f28/src/lang/helpers.ts#L53

  • locale.ts is our module based off jquery. Allows for future middle ware. Inside the IIFE parameters as well as provide an area to intercept changes required by Android/IOS (not implemented)

  • The onLoad fn housed inside of the Plugin Instance has the bootup code. Should the module fail to load, the translate default function will default to english (tested) and a error will console out via try catch.

  • moment.locale is used to detect the desired language. i18.changeLanguage() with empty parameters will also run auto detection , and with paramters will change the language. But having settings isn't your style. Myers used window.localStorage for his knobs. (i have no opinion on this matter.)

  • zhTW dictionary typed with partial so the dictionary need not be synced in lockstep with en. Updating can happen at leisure, and staggered.

    • Should the zhTW dictionary not have the word, it defaults to english.
  • Example of adding a new translated word.

    • Add the constants in the locale located in the filepath locale/en.ts (the data starts/flows from the english dictionary.)
      • CRITICAL: you must add the constant to the enkeys array
    • Import the constant to your component (plugin.js)
      • The enkeys will automatically populate the state builder inside the onload function.
    • i18nextInstance houses the api for i18next.
    • The finals step is to replace the messages with the updated dictionary values.
      • this.it[CONSTANT] will then translate accordingly.

i18-pr

  • Oversights
    • I have not tested on mobile.

Add error checking if i18 module is null.

Remove debug logs.
);
}
menu.addItem(
item("crossed-star" , "Exclude #"+tagName+" from search", () => search.openGlobalSearch(query+" -tag:" + tagName))
item("crossed-star" , `${this.it[EXCLUDE]} #${tagName} ${this.it[FROM_SEARCH]}`, () => search.openGlobalSearch(query+" -tag:" + tagName))

Choose a reason for hiding this comment

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

In short, this violates the very basics of translation.

One must NEVER concatenate strings for any reason.

Word order varies by language. Words need to conjugation to agree with substituted elements (gender agreement, case agreement (declination), sound-agreement (different words used depending if e/i or o/u are in the object, etc).

This fails for languages that:

  • Place Verb Last (JP) - #tag from-search exclude
  • Require conjugation of tag (FI) exclude #tag":n" from-search
  • Place Complement First - from-search exclude #tag
  • That split the components - search #tag-target-from exclude
  • That require reduplication - #tag-from-search #tag-target exclude
    Etc.

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.

2 participants