Wiktionary:Code-switching

Code-switching
Code-switching (or language alternation) occurs when a person alternates between two or more languages in the context of a single conversation. The occurrence of words from Language A in texts and conversations in Language B due to code-switching (which should not lead to the creation of entries defining the words as belonging to Language B) should be distinguished from the borrowing of words from Language A into Language B as loanwords (which should).

Typographical clues
When foreign-derived words are set off in italics or quotation marks, this often indicates that they have not yet been naturalized and are code-switching.

When words are set off in a different script, generally when a word from Language A is left in its native script even when used in a Language B that does not use that script, this strongly indicates code-switching. For example, the retention of Greek script strongly indicates that "ἄρχων" is code-switching in sentences like "normally an ἄρχων was a civil community leader".

Explanation
When the author adds an explanation of the meaning of a word stemming from another language, this is a strong indication that they do consider the word to be foreign.

Semantic differences
If Language B uses a word in a sense that does not exist in the ostensible donor Language A, then its use cannot be explained as code-switching; the word belongs to Language B. For example, in French, the word is frequently set off in italics and thought of as a loanword or code-switching. However, it cannot be code-switching from English, because English never means “a celebrity”; the word, with that definition, must be French. Other examples from French are and.

Spelling differences
If Language B uses a word in a spelling that does not exist in the ostensible donor Language A, this shows the word is now a loanword belonging to Language B. For example, was borrowed from. (The Turkish spelling is a pronunciation spelling that closely approximates the French pronunciation.)

Inflected forms
If Language B has inflections different from Language A, and uses these inflections on a word that ostensibly stems from A to create inflected forms, this may be taken as a sign that the borrowed word has “gone native” and become part of the lexicon of Language B. For example, Danish has a verb that means “to google”; it also has the verb form (present participle), which does not exist in English. For another example, the German adjective has the superlative am cleversten, establishing that it has become a German word.

Pronunciation
Generally, when code-switching, speakers of Language B will make an attempt to reproduce or at least approximate the pronunciation in donor Language A. If an accepted pronunciation of a word by speakers of Language B ignores the original pronunciation and instead uses the pronunciation suggested by the spelling as if the word is a native word, this is also a sign the word has been accepted as part of the vocabulary of Language B. For example, the originally English word is also spelled  in French, but is pronounced.

Concluding remark
When a language borrows a term from a donor language, it does not instantly become part of the lexicon of its new home. The adaptation is a process; during an initial period the uses will be instances of code-switching, until the users become so accustomed to the term that it may even no longer be recognized as having a foreign origin. Because that changeover from code-switching to being a loanword is also not an instantaneous event, there cannot be a hard and fast criterion for making the distinction.