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

'Pronunciation' and 'Meanings' not translated #16

Closed
Moonbase59 opened this issue Jul 21, 2021 · 14 comments
Closed

'Pronunciation' and 'Meanings' not translated #16

Moonbase59 opened this issue Jul 21, 2021 · 14 comments
Assignees
Labels

Comments

@Moonbase59
Copy link

@Moonbase59 Moonbase59 commented Jul 21, 2021

The headers 'Pronunciation' and 'Meanings' aren’t translated, and 'New Note' isn’t. All are in 'de.ts', for example.

@phibr0
Copy link
Owner

@phibr0 phibr0 commented Jul 21, 2021

I currently can't check in App, could you provide Screenshots or just explain where exactly something isn't translated? As I am checking in the Code it should all be translated fine.

@phibr0 phibr0 self-assigned this Jul 21, 2021
@phibr0 phibr0 added the bug label Jul 21, 2021
@Moonbase59
Copy link
Author

@Moonbase59 Moonbase59 commented Jul 21, 2021

Let’s take the phrases 'Pronunciation', 'Meanings' and 'New Note', which are used in the side panel and when generating a new note (for {{pronunciationHeader}} and {{meaningHeader}}).

Let’s also assume we’re using only English and German. The phrases are correct in de.ts and also make it into the plugin’s main.js:

    //dictionaryView.svelte
    'Enter a word': 'Gebe ein Wort ein',
    'Pronunciation': 'Aussprache',
    'Meanings': 'Bedeutungen',
    'New Note': 'Neue Notiz',

When setting Obsidian to German ("Deutsch"), the side panel still shows the English headings:

Auswahl_052

When I click on 'New Note', the English headings are also used in the new note:

Knowledgebase - Obsidian v0 12 10_053

@phibr0
Copy link
Owner

@phibr0 phibr0 commented Jul 21, 2021

The Language is set by Obsidians internal Moment Locale. You have set your Language to German which should turn the Plugins Language to German too. Are the Settings also all in English?

@Moonbase59
Copy link
Author

@Moonbase59 Moonbase59 commented Jul 21, 2021

The Obsidian settings are in German, those of non-translated plugins in English, yours also in English:

Auswahl_056

Reminds me of an odd problem I had, and nobody found an answer for (I’m using the moment.js locale myself to check what language Obsidian runs in): https://forum.obsidian.md/t/new-with-0-12-4-moment-locale-sticks-at-en-even-when-i-switch-obsidian-to-another-language/19673

@Moonbase59
Copy link
Author

@Moonbase59 Moonbase59 commented Jul 21, 2021

Hm. If I enter

moment().locale()

in the dev console, it gives me en. So maybe related, but for the life of me I can’t make out who or what messes with moment’s locale and sets it globally …

Let me try

moment.locale("de")

and see what happens.

Still the same:

Auswahl_052

But I wonder … if it wouldn’t work in general, why then did it translate Adjective into Adjektiv (below the Meanings header)?

@phibr0
Copy link
Owner

@phibr0 phibr0 commented Jul 22, 2021

"Adjektiv" came as part of the API Response, not from the Plugin itself. Could you maybe try to disable all Plugins except the Dictionary Plugin? Or just create a Test Vault with only that Plugin installed.

@phibr0
Copy link
Owner

@phibr0 phibr0 commented Jul 22, 2021

Also I am pretty sure that after setting the moment locale to de the View needs to be re-rendered to show changes in these Strings.

@Moonbase59
Copy link
Author

@Moonbase59 Moonbase59 commented Jul 22, 2021

Yep, I’ve later seen that it came from the API. Any idea how I could re-render the view?

I’ll try the plugin disable/new vault later on.

@phibr0
Copy link
Owner

@phibr0 phibr0 commented Jul 22, 2021

I think just closing it (right click on the icon) and opening it again with the Command should work

@Moonbase59
Copy link
Author

@Moonbase59 Moonbase59 commented Jul 22, 2021

Got it! After disabling all plugins except yours, …

  • settings come up in German
  • the side pane gets translated
  • notes created have the German text*

So I must really dig in deeper to isolate the plugin that causes the locale mess-up. Sorry for bothering you with this!

  • = There is one untranslated string still: In the dictionary-generated note, Pronunciation has a list item - undefined. "Undefined" should probably also be translated.

Knowledgebase - Obsidian v0 12 10_057

Btw, thanks for making this really useful plugin, and actually taking care of translations—not many plugins do that.

@phibr0
Copy link
Owner

@phibr0 phibr0 commented Jul 22, 2021

The undefined actually has to be a bug, it shouldn't print "Aussprache" if it doesn't have any data for it.

I think the Calendar Plugin overrides the moment locale but I am not sure.

@Moonbase59
Copy link
Author

@Moonbase59 Moonbase59 commented Jul 22, 2021

Calendar: Yeah, someone mentioned that in the forums, but I’ve never used that. So there must be another miscreant ;-)

Doesn’t the note always contain all information, even if there’s nothing in it? If not, we have another minor bug.

phibr0 added a commit that referenced this issue Jul 22, 2021
@phibr0
Copy link
Owner

@phibr0 phibr0 commented Jul 22, 2021

Since this isn't really a Issue of this Plugin i will close this for now. The other Plugins which are localized also get the locale from moment which is why I think it's fine like that.

@phibr0 phibr0 closed this Jul 22, 2021
@Moonbase59
Copy link
Author

@Moonbase59 Moonbase59 commented Jul 22, 2021

Yep. I finally found the miscreant: It was the Obsidian Pomodoro Plugin that globally set the moment locale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants